Hi Rick, Thanks, I will try upgrading and see if it fixes the issue. I have a feeling that I'm missing something here though..
--- Yaniv On Wed, Sep 7, 2011 at 2:16 PM, Rick Bullotta <rick.bullo...@thingworx.com>wrote: > While I don't know that it will change anything, any reason that you're > using M06 and not 1.4.1? There have been quite a few important fixes. > Also, the analyzer that is used to tokenize both the indexed content and > the query have an effect on the query processing. In any case, I would > update to 1.4.1 so that diagnosing the issues would be significantly easier. > > ________________________________________ > From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On > Behalf Of Yaniv Ben Yosef [yani...@gmail.com] > Sent: Wednesday, September 07, 2011 6:16 AM > To: Neo4j user discussions > Subject: [Neo4j] Querying a full text index > > 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