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(); IndexNode 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
Re: [Neo4j] Newbie issues with indexing
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(); IndexNode 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
Re: [Neo4j] Newbie issues with indexing
...because you have a space character in the name. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Bill Baker [bill...@billbak.com] Sent: Wednesday, November 02, 2011 11:33 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 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(); IndexNode 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 ___ Neo4j mailing list User@lists.neo4j.org https://lists.neo4j.org/mailman/listinfo/user
Re: [Neo4j] Newbie issues with indexing
Got it, quote the string so the spaces don't matter, thanks. NodeType:Bar AND Name:\Bar 1\ seems inconsistent. It has five quotes. I will try this: NodeType:Bar AND Name:\Bar 1\ as I _think_ the version above has unmatched quotes. Thanks everyone, I appreciate the help. -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Rick Bullotta Sent: Wednesday, November 02, 2011 8:44 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing ...because you have a space character in the name. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Bill Baker [bill...@billbak.com] Sent: Wednesday, November 02, 2011 11:33 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 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(); IndexNode 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 ___ 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
Re: [Neo4j] Newbie issues with indexing
2011/11/2 Bill Baker bill...@billbak.com Got it, quote the string so the spaces don't matter, thanks. NodeType:Bar AND Name:\Bar 1\ seems inconsistent. It has five quotes. I will try this: NodeType:Bar AND Name:\Bar 1\ as I _think_ the version above has unmatched quotes. It's how the java code looks and it's consistent, it's copy-pasted from a passing test with your data that I wrote up for this :) Thanks everyone, I appreciate the help. -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Rick Bullotta Sent: Wednesday, November 02, 2011 8:44 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing ...because you have a space character in the name. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Bill Baker [bill...@billbak.com] Sent: Wednesday, November 02, 2011 11:33 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 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(); IndexNode 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 ___ 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 -- 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
Re: [Neo4j] Newbie issues with indexing
Then I will try it straight-up! -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Mattias Persson Sent: Wednesday, November 02, 2011 9:39 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 2011/11/2 Bill Baker bill...@billbak.com Got it, quote the string so the spaces don't matter, thanks. NodeType:Bar AND Name:\Bar 1\ seems inconsistent. It has five quotes. I will try this: NodeType:Bar AND Name:\Bar 1\ as I _think_ the version above has unmatched quotes. It's how the java code looks and it's consistent, it's copy-pasted from a passing test with your data that I wrote up for this :) Thanks everyone, I appreciate the help. -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Rick Bullotta Sent: Wednesday, November 02, 2011 8:44 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing ...because you have a space character in the name. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Bill Baker [bill...@billbak.com] Sent: Wednesday, November 02, 2011 11:33 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 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(); IndexNode 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 ___ 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 -- 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
Re: [Neo4j] Newbie issues with indexing
Got it running, thank you! -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Bill Baker Sent: Wednesday, November 02, 2011 9:41 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing Then I will try it straight-up! -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Mattias Persson Sent: Wednesday, November 02, 2011 9:39 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 2011/11/2 Bill Baker bill...@billbak.com Got it, quote the string so the spaces don't matter, thanks. NodeType:Bar AND Name:\Bar 1\ seems inconsistent. It has five quotes. I will try this: NodeType:Bar AND Name:\Bar 1\ as I _think_ the version above has unmatched quotes. It's how the java code looks and it's consistent, it's copy-pasted from a passing test with your data that I wrote up for this :) Thanks everyone, I appreciate the help. -Original Message- From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On Behalf Of Rick Bullotta Sent: Wednesday, November 02, 2011 8:44 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing ...because you have a space character in the name. From: user-boun...@lists.neo4j.org [user-boun...@lists.neo4j.org] On Behalf Of Bill Baker [bill...@billbak.com] Sent: Wednesday, November 02, 2011 11:33 AM To: Neo4j user discussions Subject: Re: [Neo4j] Newbie issues with indexing 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(); IndexNode 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 ___ 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 -- Mattias Persson, [matt...@neotechnology.com] Hacker, Neo Technology www.neotechnology.com
[Neo4j] Newbie issues with indexing
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(); IndexNode 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