Hi Axel, I've read the syntax, which is why I was surprised. There are wildcard options in the syntax, e.g.: test* and test? and even te*st. So I would expect that [director*] should return director and directory. [director], if I understand the syntax correctly, should return just director. But actually, it also returns director and directory in my code. This means that [director] is equivalent to [director*], which I find a bit strange.
In your example - the query ["director"] also returns both director and directory. The only thing that works is [+director]. Thing is, I don't want to force my users to remember advanced syntax and append a + to each word. And I also don't want to start parsing queries. I imagine that the syntax in the Lucene documentation should work (i.e., [director] *should not* be equivalent to [director*]. It's either a bug somewhere, or I'm not configuring/using something correctly. Anyone has an idea? Thanks again, --- Yaniv On Wed, Sep 7, 2011 at 8:31 PM, Axel Morgner <a...@morgner.de> wrote: > Hi Yaniv, > > didn't try your case, just read the code. If I remember correctly, it may > help to expand your search term "director john" into a Lucene query, e.g. > something like "\"director\" OR \"john\"". > > The complete Lucene query syntax see [1]. > > Greetings > > Axel > > [1] http://lucene.apache.org/java/3_1_0/queryparsersyntax.html > > Am 07.09.2011 um 12:16 schrieb Yaniv Ben Yosef: > > > Hi, > > > > This question may be Lucene related, but since I'm using it via Neo4J I'm > > asking here first. I'm using Neo4J 1.4 M06. > > I have a graph representing people, with a few properties about each > person > > (e.g., their name and job title). > > Now I'd like to create a search form that will allow the user to enter > > either the person's first name, last name, title, or any combination. For > > example, the query [john director] should result with all the people > whose > > name or title contain both john and director. > > To play with that, I created this little psvm: > > > > public class FullTextIndexTest > > { > > public static void main(String[] args) > > { > > GraphDatabaseService graphDb = > > GraphDatabaseServiceFactory.createGraphDatabase("target/var/db"); > > > > Transaction t = graphDb.beginTx(); > > Node n1 = graphDb.createNode(); > > n1.setProperty("name", "John Smith"); > > n1.setProperty("title", "Directory Manager"); > > > > Node n2 = graphDb.createNode(); > > n2.setProperty("name", "Johnny Malkovich"); > > n2.setProperty("title", "Director of R&D"); > > > > Node n3 = graphDb.createNode(); > > n3.setProperty("name", "John Horovich"); > > n3.setProperty("title", "Sr. Director"); > > > > IndexManager index = graphDb.index(); > > Index<Node> fulltextPerson = index.forNodes("person-fulltext", > > MapUtil.stringMap(IndexManager.PROVIDER, "lucene", "type", > > "fulltext")); > > fulltextPerson.add(n1, "combined", n1.getProperty("name") + " " + > > n1.getProperty("title")); > > fulltextPerson.add(n2, "combined", n2.getProperty("name") + " " + > > n2.getProperty("title")); > > fulltextPerson.add(n3, "combined", n3.getProperty("name") + " " + > > n3.getProperty("title")); > > t.success(); > > t.finish(); > > > > // search in the fulltext index > > IndexHits<Node> hits = fulltextPerson.query("combined", "director > > john"); > > System.out.printf("Found %d results:\n", hits.size()); > > for (Node node : hits) > > { > > System.out.println(node.getProperty("name") + ", " + > > node.getProperty("title")); > > } > > } > > } > > > > > > I expected this program to return 1 result: John Horovich, Sr. Director > > Instead, I'm getting 3: > > > > John Horovich, Sr. Director > > John Smith, Directory Manager > > Johnny Malkovich, Director of R&D > > > > It seems that Lucene will "accept" terms that contain a query term (e.g, > > Directory and Johnny) even if I'm not using any wildcards in my query. > How > > do I turn this behavior off? I'd like the results to contain only people > > whose name or title *contain* the word john, but not johnny. > > > > Thanks! > > --- Yaniv > > _______________________________________________ > > Neo4j mailing list > > User@lists.neo4j.org > > https://lists.neo4j.org/mailman/listinfo/user > > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user