At the time of creation extra configuration can be specified to control the behavior of the index and which backend to use. For example to create a Lucene fulltext index:
IndexManager index = graphDb.index(); Index<Node> fulltextMovies = index.forNodes( "movies-fulltext", MapUtil.stringMap( IndexManager.PROVIDER, "lucene", "type", "fulltext" ) ); fulltextMovies.add( theMatrix, "title", "The Matrix" ); fulltextMovies.add( theMatrixReloaded, "title", "The Matrix Reloaded" ); // search in the fulltext index Node found = fulltextMovies.query( "title", "reloAdEd" ).getSingle();
Here’s an example of how to create an exact index which is case-insensitive:
Index<Node> index = graphDb.index().forNodes( "exact-case-insensitive", stringMap( "type", "exact", "to_lower_case", "true" ) ); Node node = graphDb.createNode(); index.add( node, "name", "Thomas Anderson" ); assertContains( index.query( "name", "\"Thomas Anderson\"" ), node ); assertContains( index.query( "name", "\"thoMas ANDerson\"" ), node );
Tip In order to search for tokenized words, the |
The configuration of the index is persisted once the index has been created.
The provider
configuration key is interpreted by Neo4j, but any other configuration is passed onto the backend index (e.g. Lucene) to interpret.
Lucene indexing configuration parameters
Parameter | Possible values | Effect |
---|---|---|
|
|
|
|
| This parameter goes together with |
| the full class name of an Analyzer | Overrides the |