1
votes

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

1 Answers

4
votes

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

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