【发布时间】:2013-04-15 23:00:20
【问题描述】:
我目前正在努力使用 Cypher 中的全文索引和自动索引。
我使用的是 Java 嵌入式 Neo4j v 1.8.2。
我的基本问题是:如何使用 Cypher 查询全文索引?
当我创建以下索引时:
Index<Node> fulltextIndex = index.forNodes( "fulltextIndex",
MapUtil.stringMap( IndexManager.PROVIDER, "lucene",
"type", "fulltext" ) );
以下 Cypher 语句不返回任何内容:
START n=node:fulltextIndex(name='*er*') RETURN n;
下面的 java 代码返回了所需的节点:
Node found = fulltextIndex.query("name", "*er*").getSingle();
id= found.getId();
String cypherQuery="START n=node("+id+") RETURN n";
那么实际上区别在哪里?为什么 Cypher 语句不起作用?
我还想知道是否有任何方法可以将全文索引与自动索引结合起来?以下(如http://docs.neo4j.org/chunked/milestone/auto-indexing.html 所示)似乎不起作用:
Index<Node> fulltextIndex = index.forNodes("node_auto_index", "fulltextIndex",
MapUtil.stringMap( IndexManager.PROVIDER, "lucene",
"type", "fulltext" ) );
有什么想法吗?
谢谢!
【问题讨论】: