19.3. Lucene Directory Configuration for Replicated Indexing

Define the following properties in the Hibernate configuration and in the Persistence unit configuration file when using standard JPA. For instance, to change all of the default storage indexes the following property could be configured:
hibernate.search.default.directory_provider=infinispan
This may also be performed on unique indexes. In the following example tickets and actors are index names:
hibernate.search.tickets.directory_provider=infinispan
hibernate.search.actors.directory_provider=filesystem
Lucene's DirectoryProvider uses the following options to configure the cache names:
  • locking_cachename - Cache name where Lucene's locks are stored. Defaults to LuceneIndexesLocking.
  • data_cachename - Cache name where Lucene's data is stored, including the largest data chunks and largest objects. Defaults to LuceneIndexesData.
  • metadata_cachename - Cache name where Lucene's metadata is stored. Defaults to LuceneIndexesMetadata.
To adjust the name of the locking cache to CustomLockingCache use the following:
hibernate.search.default.directory_provider.locking_cachname="CustomLockingCache"
In addition, large files of the index are split into a smaller, configurable, chunk. It is often recommended to set the index's chunk_size to the highest value that may be handled efficiently by the network.
Hibernate Search already contains internally a default configuration which uses replicated caches to hold the indexes.
It is important that if more than one node writes to the index at the same time, configure a JMS backend. For more information on the configuration, see the Hibernate Search documentation.

Important

In settings where distribution mode is needed to configure, the LuceneIndexesMetadata and LuceneIndexesLocking caches should always use replication mode in all the cases.