Chapter 24. Lucene

 

Apache Lucene is a high-performance, full-featured text search engine library written entirely in Java. It is a technology suitable for nearly any application that requires full-text search, especially cross-platform. Apache Lucene is an open source project available for free download.

 
 -- Apache Lucene Homepage

Titan supports Lucene as a single-machine, embedded index backend. Lucene has a slightly extended feature set and performs better in small-scale applications compared to Elasticsearch, but is limited to single-machine deployments.

24.1. Lucene Embedded Configuration

For single machine deployments, Lucene runs embedded with Titan. Titan starts and interfaces with Lucene internally.

To run Lucene embedded, add the following configuration options to the graph configuration file where `/tmp/searchindex/`specifies the directory where Lucene should store the index data:

index.search.backend=lucene
index.search.directory=/tmp/searchindex

In the above configuration, the index backend is named search. Replace search by a different name to change the name of the index.

24.2. Feature Support

  • Full-Text: Supports all Text predicates to search for text properties that matches a given word, prefix or regular expression.
  • Geo: Supports the Geo.WITHIN condition to search for points that fall within a given geographic shape. Only supports points for indexing and circles and boxes for querying.
  • Numeric Range: Supports all numeric comparisons in Compare.
  • Temporal: Nanosecond granularity temporal indexing.

24.3. Configuration Options

Refer to Chapter 12, Configuration Reference for a complete listing of all Lucene specific configuration options in addition to the general Titan configuration options.

Note, that each of the index backend options needs to be prefixed with index.[INDEX-NAME]. where [INDEX-NAME] stands for the name of the index backend. For instance, if the index backend is named search then these configuration options need to be prefixed with index.search.. To configure an index backend named search to use Lucene as the index system, set the following configuration option:

index.search.backend = lucene

24.4. Further Reading

  • Please refer to the Lucene homepage and available documentation for more information on Lucene.