Neo4j: fulltext indices and auto indexing in Cypher

孤街浪徒 提交于 2019-12-13 02:39:38

问题


I'm currently struggeling with fulltext indices and auto indexing in Cypher.

I'm using Java embedded, Neo4j v 1.8.2.

My basic question is: How can fulltext indices be queried with Cypher?

When I create the following index:

Index<Node> fulltextIndex = index.forNodes( "fulltextIndex",
            MapUtil.stringMap( IndexManager.PROVIDER, "lucene",
            "type", "fulltext" ) );

The following Cypher statement does not return anything:

START n=node:fulltextIndex(name='*er*') RETURN n;

The following piece of java code returns the desired node though:

Node found = fulltextIndex.query("name", "*er*").getSingle();
id= found.getId();
String cypherQuery="START n=node("+id+") RETURN n";

So where's actually the difference? Why does the Cypher statement not work?

Also I'd like to if there's any way to combine fulltext indexing with auto indexing? The following (as seen on http://docs.neo4j.org/chunked/milestone/auto-indexing.html) does not seem to work:

Index<Node> fulltextIndex = index.forNodes("node_auto_index", "fulltextIndex",
            MapUtil.stringMap( IndexManager.PROVIDER, "lucene",
            "type", "fulltext" ) );

Any ideas?

Thank you!


回答1:


Try the following Cypher statement as your Lucene query seems to be wrong:

START n=node:fulltextIndex("name:*er*") RETURN n;


来源:https://stackoverflow.com/questions/16026027/neo4j-fulltext-indices-and-auto-indexing-in-cypher

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