问题
I'm playing around with neo4j community edition 2.0.1, and I've struck a problem which I can't find a solution to. My ineptitude with Cypher may be contributing to my issues!
I have a small number of nodes, with an index on a "Name" property. For demonstration purposes, I have two nodes "Foo" and "Foo Bar". Running any of the following Cypher queries in the browser interface works fine - returning either one or both nodes:
START n=node:node_auto_index("Name:Foo") match n RETURN n
START n=node:node_auto_index("Name:Foo*") match n RETURN n
However, running the following query returns a Neo database error (Neo.DatabaseError.Statement.ExecutionFailure) - note the space in the name:
START n=node:node_auto_index("Name:Foo Bar") match n RETURN n
I'm at a loss as to what this issue might be - is this an error with my search request, or a known problem with the database? Many thanks!
回答1:
The string supplied to node:node_auto_index
is passed directly to the index provider (which is Lucene by default). There Lucene query syntax applies, see: http://lucene.apache.org/core/2_9_4/queryparsersyntax.html.
Space is a term separator in your case, so you might try:
START n=node:node_auto_index("Name:'Foo Bar'") match n RETURN n
(Actually - it's as per Stefan's comment below:
START n=node:node_auto_index('Name:"Foo Bar"') match n RETURN n
Thanks Stefan!)
来源:https://stackoverflow.com/questions/24177602/neo4j-database-execution-error-searching-against-an-index-with-a-node-name-conta