Prev |  | Next

## 14.10. Configuration and fulltext indexes

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();

| Tip
In order to search for tokenized words, the `query` method has to be used. The `get` method will only match the full string value, not the tokens.

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
--- | --- | ---
`type` | `exact`, `fulltext` | `exact` is the default and uses a Lucene keyword analyzer. `fulltext` uses a white-space tokenizer in its analyzer.
`to_lower_case` | `true`, `false` | This parameter goes together with `type`: `fulltext` and converts values to lower case during both additions and querying, making the index case insensitive. Defaults to `true`.
`analyzer` | the full class name of an Analyzer | Overrides the `type` so that a custom analyzer can be used. Note: `to_lower_case` still affects lowercasing of string queries. If the custom analyzer uppercases the indexed tokens, string queries will not match as expected.

Copyright © 2011 Neo Technology

Prev | Up | Next
| Home |