Neo4j database execution error searching against an index with a node name containing a space

陌路散爱 提交于 2019-12-11 02:46:55

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!