Thanks Mattias. One node is a Foo node and one is a Bar node. Maybe I am being too fancy; I could just use 'NAME' for any type of node.
I'm a little confused about the query string below. Should it perhaps be "NodeType:Bar" AND "Name:Bar 1" ? I'm not getting why the property name is inside the quotes for one predicate and not the other (below.) Thanks! -----Original Message----- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Mattias Persson Sent: Wednesday, November 02, 2011 3:56 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing Hi Bill, Why BarName in one and FooName in the other? I'm assuming you have NodeType/Name for both ok? So... a query like this would look like: nodeIndex.query( "NodeType:Bar" AND Name:\"Bar 1\"" ); 2011/11/1 Bill Baker <bill...@billbak.com> > Hello, > > I have an index and add my nodes to it as I create them. I index two > properties, nodeType and nodeName. Later I want to see if a node > already exists of a given type and a given name. If it does, I'll use > it; otherwise I'll create it (and index it.) (All this is in the Java > API.) > > IndexManager indexMgr = graphDB.index(); Index<Node> nodeIndex = > indexMgr.forNodes("NodeType"); > > Later on I create a node (newNode) with properties NodeType = "Bar" > and BarName = "Bar 1" and another with NodeType = "Foo" and FooName = "Foo 1". > > nodeIndex.add (newNode, "NodeType", "Bar"); nodeIndex.add (newNode, > "BarName, "Bar 1"); nodeIndex.add (newNode2, "NodeType", "Foo"); > nodeIndex.add)newNode2, "FooName", "Foo 1"); etc. > > Still later, I want to see if I already have a node of type Bar with > name Bar 1. I read up on the query syntax in 7.7 ( > http://docs.neo4j.org/chunked/stable/indexing-search.html) and noticed > that the syntax listed there does not support any white space in the > query string. So I am looking into how to use Lucene query objects to > form my query. But now I'm stumped. > > I want to get a list (IndexHits is fine) of any nodes in the system > that have these two properties (NodeType and BarType) set to specific > values. I think there might be more to Lucene Query objects than just > TermQuery. Is that in the Neo4j docs, the Lucene docs? Any examples handy? > > Thanks in advance! > > Bill > > > -------------------------------------------------- > Bill Baker, Investor, Advisor, Board Member > 206-619-0928 > My other house is a data warehouse > > _______________________________________________ > Neo4j mailing list > User@lists.neo4j.org > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com _______________________________________________ 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