Class LuceneIndexSettings


  • public final class LuceneIndexSettings
    extends Object
    Configuration properties for Lucene indexes.

    Constants in this class are to be appended to a prefix to form a property key; see IndexSettings for details.

    • Field Detail

      • DIRECTORY_PREFIX

        public static final String DIRECTORY_PREFIX
        The prefix for directory-related property keys.
        See Also:
        Constant Field Values
      • DIRECTORY_ROOT

        public static final String DIRECTORY_ROOT
        The filesystem root for the directory.

        Only available for the "local-filesystem" directory type.

        Expects a String representing a path to an existing directory accessible in read and write mode, such as "local-filesystem".

        The actual index files will be created in directory <root>/<index-name>.

        Defaults to the JVM's working directory.

        See Also:
        Constant Field Values
      • DIRECTORY_LOCKING_STRATEGY

        public static final String DIRECTORY_LOCKING_STRATEGY
        How to lock on the directory.

        Expects a LockingStrategyName value, or a String representation of such value.

        Defaults are specific to each directory type.

        See Also:
        Constant Field Values
      • IO_COMMIT_INTERVAL

        public static final String IO_COMMIT_INTERVAL
        How much time may pass after an index change until the change is committed.

        Only available for the "near-real-time" I/O strategy.

        This effectively defines how long changes may be in an "unsafe" state, where a crash or power loss will result in data loss. For example:

        • if set to 0, changes are safe as soon as the background process finishes treating a batch of changes.
        • if set to 1000, changes may not be safe for an additional 1 second after the background process finishes treating a batch. There is a benefit, though: index changes occurring less than 1 second after another change may execute faster.

        Note that individual write operations may trigger a forced commit (for example with the write-sync and sync indexing plan synchronization strategies in the ORM mapper), in which case you will only benefit from a non-zero commit interval during intensive indexing (mass indexer, ...).

        Note that committing is not necessary to make changes visible to search queries: the two concepts are unrelated. See IO_REFRESH_INTERVAL.

        Expects a positive Integer value in milliseconds, such as 1000, or a String that can be parsed into such Integer value.

        Defaults to LuceneIndexSettings.Defaults.IO_COMMIT_INTERVAL.

        See Also:
        Constant Field Values
      • IO_REFRESH_INTERVAL

        public static final String IO_REFRESH_INTERVAL
        How much time may pass after an index write until the index reader is considered stale and re-created.

        Only available for the "near-real-time" I/O strategy.

        This effectively defines how out-of-date search query results may be. For example:

        • If set to 0, search results will always be completely in sync with the index writes.
        • If set to 1000, search results may reflect the state of the index at most 1 second ago. There is a benefit, though: in situations where the index is being frequently written to, search queries executed less than 1 second after another query may execute faster.

        Note that individual write operations may trigger a forced refresh (for example with the read-sync and sync indexing plan synchronization strategies in the ORM mapper), in which case you will only benefit from a non-zero refresh interval during intensive indexing (mass indexer, ...).

        Expects a positive Integer value in milliseconds, such as 1000, or a String that can be parsed into such Integer value.

        Defaults to LuceneIndexSettings.Defaults.IO_REFRESH_INTERVAL.

        See Also:
        Constant Field Values
      • IO_WRITER_PREFIX

        public static final String IO_WRITER_PREFIX
        The prefix for property keys related to the index writer.
        See Also:
        Constant Field Values
      • IO_WRITER_MAX_BUFFERED_DOCS

        public static final String IO_WRITER_MAX_BUFFERED_DOCS
        The value to pass to IndexWriterConfig.setMaxBufferedDocs(int).

        Expects a positive Integer value, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        IndexWriterConfig.setMaxBufferedDocs(int), Constant Field Values
      • IO_WRITER_RAM_BUFFER_SIZE

        public static final String IO_WRITER_RAM_BUFFER_SIZE
        The value to pass to IndexWriterConfig.setRAMBufferSizeMB(double).

        Expects a positive Integer value in megabytes, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        IndexWriterConfig.setRAMBufferSizeMB(double), Constant Field Values
      • IO_WRITER_INFOSTREAM

        public static final String IO_WRITER_INFOSTREAM
        Whether to log the IndexWriterConfig.setInfoStream(InfoStream) (at the trace level) or not.

        Logs are appended to the logger "org.hibernate.search.backend.lucene.infostream".

        Expects a Boolean value such as true or false, or a String that can be parsed into such Boolean value.

        Default is false.

        See Also:
        IndexWriterConfig.setInfoStream(InfoStream), Constant Field Values
      • IO_MERGE_PREFIX

        public static final String IO_MERGE_PREFIX
        The prefix for property keys related to merge.
        See Also:
        Constant Field Values
      • IO_MERGE_MAX_DOCS

        public static final String IO_MERGE_MAX_DOCS
        The value to pass to LogMergePolicy.setMaxMergeDocs(int).

        Expects a positive Integer value, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        LogMergePolicy.setMaxMergeDocs(int), Constant Field Values
      • IO_MERGE_FACTOR

        public static final String IO_MERGE_FACTOR
        The value to pass to LogMergePolicy.setMergeFactor(int).

        Expects a positive Integer value, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        LogMergePolicy.setMergeFactor(int), Constant Field Values
      • IO_MERGE_MIN_SIZE

        public static final String IO_MERGE_MIN_SIZE
        The value to pass to LogByteSizeMergePolicy.setMinMergeMB(double).

        Expects a positive Integer value in megabytes, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        LogByteSizeMergePolicy.setMinMergeMB(double), Constant Field Values
      • IO_MERGE_MAX_SIZE

        public static final String IO_MERGE_MAX_SIZE
        The value to pass to LogByteSizeMergePolicy.setMaxMergeMB(double).

        Expects a positive Integer value in megabytes, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        LogByteSizeMergePolicy.setMaxMergeMB(double), Constant Field Values
      • IO_MERGE_MAX_FORCED_SIZE

        public static final String IO_MERGE_MAX_FORCED_SIZE
        The value to pass to LogByteSizeMergePolicy.setMaxMergeMBForForcedMerge(double).

        Expects a positive Integer value in megabytes, or a String that can be parsed into such Integer value.

        The default for this setting is defined by Lucene.

        See Also:
        LogByteSizeMergePolicy.setMaxMergeMBForForcedMerge(double), Constant Field Values
      • IO_MERGE_CALIBRATE_BY_DELETES

        public static final String IO_MERGE_CALIBRATE_BY_DELETES
        The value to pass to LogMergePolicy.setCalibrateSizeByDeletes(boolean).

        Expects a Boolean value such as true or false, or a String that can be parsed into such Boolean value.

        The default for this setting is defined by Lucene.

        See Also:
        LogMergePolicy.setCalibrateSizeByDeletes(boolean), Constant Field Values
      • SHARDING_PREFIX

        public static final String SHARDING_PREFIX
        The prefix for sharding-related property keys.
        See Also:
        Constant Field Values
      • SHARDING_STRATEGY

        public static final String SHARDING_STRATEGY
        The sharding strategy, deciding the number of shards, their identifiers, and how to translate a routing key into a shard identifier.

        Expects a String, such as "hash". See the reference documentation for a list of available values.

        Defaults to LuceneIndexSettings.Defaults.SHARDING_STRATEGY (no sharding).

        See Also:
        Constant Field Values
      • SHARDING_NUMBER_OF_SHARDS

        public static final String SHARDING_NUMBER_OF_SHARDS
        The number of shards to create for the index, i.e. the number of "physical" indexes, each holding a part of the index data.

        Only available for the hash sharding strategy.

        Expects a strictly positive Integer value, such as 4, or a String that can be parsed into such Integer value.

        No default: this property must be set when using the hash sharding strategy.

        See Also:
        Constant Field Values
      • SHARDING_SHARD_IDENTIFIERS

        public static final String SHARDING_SHARD_IDENTIFIERS
        The list of shard identifiers to accept for the index.

        Only available for the explicit sharding strategy.

        Expects either a String containing multiple shard identifiers separated by commas (','), or a Collection<String> containing such shard identifiers.

        No default: this property must be set when using the explicit sharding strategy.

        See Also:
        Constant Field Values
      • SHARDS

        public static final String SHARDS
        The root property whose children are shards, e.g. shards.0.<some shard-scoped property> = bar or shards.1.<some shard-scoped property> = bar or shards.main.<some shard-scoped property> = bar.
        See Also:
        Constant Field Values
      • INDEXING_PREFIX

        public static final String INDEXING_PREFIX
        The prefix for indexing-related property keys.
        See Also:
        Constant Field Values
      • INDEXING_QUEUE_COUNT

        public static final String INDEXING_QUEUE_COUNT
        The number of indexing queues assigned to each index (or each shard of each index, when sharding is enabled).

        Expects a strictly positive integer value, or a string that can be parsed into an integer value.

        See the reference documentation, section "Lucene backend - Indexing", for more information about this setting and its implications.

        Defaults to LuceneIndexSettings.Defaults.INDEXING_QUEUE_COUNT.

        See Also:
        Constant Field Values
      • INDEXING_QUEUE_SIZE

        public static final String INDEXING_QUEUE_SIZE
        The size of indexing queues.

        Expects a strictly positive integer value, or a string that can be parsed into an integer value.

        See the reference documentation, section "Lucene backend - Indexing", for more information about this setting and its implications.

        Defaults to LuceneIndexSettings.Defaults.INDEXING_QUEUE_SIZE.

        See Also:
        Constant Field Values
    • Method Detail

      • shardKey

        public static String shardKey​(String shardId,
                                      String radical)
        Builds a configuration property key for the given shard of all indexes of the default backend, with the given radical.

        See constants in this class for available radicals.

        Example result: "hibernate.search.backend.shard.<shardId>.indexing.queue_count"
        Parameters:
        shardId - The identifier of the shard to configure.
        radical - The radical of the configuration property (see constants in this class).
        Returns:
        the concatenated shard settings key
      • shardKey

        public static String shardKey​(String indexName,
                                      String shardId,
                                      String radical)
        Builds a configuration property key for the given shard of the given index of the default backend, with the given radical.

        See constants in this class for available radicals.

        Example result: "hibernate.search.backends.<backendName>.indexes.<indexName>.shard.<shardId>.indexing.queue_count"
        Parameters:
        indexName - The name of the index in which the shard to configure is located.
        shardId - The identifier of the shard to configure.
        radical - The radical of the configuration property (see constants in this class).
        Returns:
        the concatenated shard settings key
      • shardKey

        public static String shardKey​(String backendName,
                                      String indexName,
                                      String shardId,
                                      String radical)
        Builds a configuration property key for the given shard of the given index of the given backend, with the given radical.

        See constants in this class for available radicals.

        Example result: "hibernate.search.backends.<backendName>.indexes.<indexName>.shard.<shardId>.indexing.queue_count"
        Parameters:
        backendName - The name of the backend in which the shard to configure is located.
        indexName - The name of the index in which the shard to configure is located.
        shardId - The identifier of the shard to configure.
        radical - The radical of the configuration property (see constants in this class).
        Returns:
        the concatenated shard settings key