Neo4j数据库执行错误搜索节点名称包含空格的索引 [英] Neo4j database execution error searching against an index with a node name containing a space
问题描述
我正在使用neo4j社区版本2.0.1,但遇到了一个我找不到解决方案的问题.我对Cypher的无礼可能是我的问题所在!
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!
我的节点数量很少,在名称"(Name)属性上有一个索引.为了演示,我有两个节点"Foo"和"Foo Bar".在浏览器界面中运行以下任何Cypher查询都可以正常工作-返回一个或两个节点:
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
但是,运行以下查询将返回Neo数据库错误(Neo.DatabaseError.Statement.ExecutionFailure)-注意名称中的空格:
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!
推荐答案
提供给node:node_auto_index
的字符串直接传递给索引提供程序(默认为Lucene). Lucene查询语法适用,请参见: http://lucene.apache.org/core/2_9_4 /queryparsersyntax.html .
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
(实际上-根据以下Stefan的评论:
(Actually - it's as per Stefan's comment below:
START n=node:node_auto_index('Name:"Foo Bar"') match n RETURN n
感谢Stefan!)
这篇关于Neo4j数据库执行错误搜索节点名称包含空格的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!