Class LuceneIndexSettings
- java.lang.Object
-
- org.hibernate.search.backend.lucene.cfg.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LuceneIndexSettings.Defaults
Default values for the different settings if no values are given.static class
LuceneIndexSettings.DirectoryRadicals
Configuration property keys for directories without theprefix
.static class
LuceneIndexSettings.IndexingRadicals
Configuration property keys for indexing, without theprefix
.static class
LuceneIndexSettings.IORadicals
Configuration property keys for I/O, without theprefix
.static class
LuceneIndexSettings.MergeRadicals
Configuration property keys for merge options, without theprefix
.static class
LuceneIndexSettings.ShardingRadicals
Configuration property keys for sharding, without theprefix
.static class
LuceneIndexSettings.WriterRadicals
Configuration property keys for index writer options, without theprefix
.
-
Field Summary
Fields Modifier and Type Field Description static String
DIRECTORY_FILESYSTEM_ACCESS_STRATEGY
The filesystem access strategy for the directory.static String
DIRECTORY_LOCKING_STRATEGY
The locking strategy the directory.static String
DIRECTORY_PREFIX
The prefix for directory-related property keys.static String
DIRECTORY_ROOT
The filesystem root the directory.static String
DIRECTORY_TYPE
The type of directory to use when reading from or writing to the index.static String
INDEXING_PREFIX
The prefix for indexing-related property keys.static String
INDEXING_QUEUE_COUNT
The number of indexing queues assigned to each index (or each shard of each index, when sharding is enabled).static String
INDEXING_QUEUE_SIZE
The size of indexing queues.static String
IO_COMMIT_INTERVAL
How much time may pass after an index change until the change is committed.static String
IO_MERGE_CALIBRATE_BY_DELETES
The value to pass toLogMergePolicy.setCalibrateSizeByDeletes(boolean)
.static String
IO_MERGE_FACTOR
The value to pass toLogMergePolicy.setMergeFactor(int)
.static String
IO_MERGE_MAX_DOCS
The value to pass toLogMergePolicy.setMaxMergeDocs(int)
.static String
IO_MERGE_MAX_FORCED_SIZE
The value to pass toLogByteSizeMergePolicy.setMaxMergeMBForForcedMerge(double)
.static String
IO_MERGE_MAX_SIZE
The value to pass toLogByteSizeMergePolicy.setMaxMergeMB(double)
.static String
IO_MERGE_MIN_SIZE
The value to pass toLogByteSizeMergePolicy.setMinMergeMB(double)
.static String
IO_MERGE_PREFIX
The prefix for property keys related to merge.static String
IO_PREFIX
The prefix for I/O-related property keys.static String
IO_REFRESH_INTERVAL
How much time may pass after an index write until the index reader is considered stale and re-created.static String
IO_STRATEGY
The I/O strategy, deciding how indexes are written to and read from.static String
IO_WRITER_INFOSTREAM
Whether to log theIndexWriterConfig.setInfoStream(InfoStream)
(at the trace level) or not.static String
IO_WRITER_MAX_BUFFERED_DOCS
The value to pass toIndexWriterConfig.setMaxBufferedDocs(int)
.static String
IO_WRITER_PREFIX
The prefix for property keys related to the index writer.static String
IO_WRITER_RAM_BUFFER_SIZE
The value to pass toIndexWriterConfig.setRAMBufferSizeMB(double)
.static String
SHARDING_NUMBER_OF_SHARDS
The number of shards to create for the index, i.e.static String
SHARDING_PREFIX
The prefix for sharding-related property keys.static String
SHARDING_SHARD_IDENTIFIERS
The list of shard identifiers to accept for the index.static String
SHARDING_STRATEGY
The sharding strategy, deciding the number of shards, their identifiers, and how to translate a routing key into a shard identifier.static String
SHARDS
The root property whose children are shards, e.g.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.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.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.
-
-
-
Field Detail
-
DIRECTORY_PREFIX
public static final String DIRECTORY_PREFIX
The prefix for directory-related property keys.- See Also:
- Constant Field Values
-
DIRECTORY_TYPE
public static final String DIRECTORY_TYPE
The type of directory to use when reading from or writing to the index.Expects a String, such as "local-filesystem". See the reference documentation for a list of available values.
Defaults to
LuceneIndexSettings.Defaults.DIRECTORY_TYPE
.- See Also:
- Constant Field Values
-
DIRECTORY_ROOT
public static final String DIRECTORY_ROOT
The filesystem root 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 (
LuceneIndexSettings.Defaults.DIRECTORY_ROOT
).- See Also:
- Constant Field Values
-
DIRECTORY_LOCKING_STRATEGY
public static final String DIRECTORY_LOCKING_STRATEGY
The locking strategy 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
-
DIRECTORY_FILESYSTEM_ACCESS_STRATEGY
public static final String DIRECTORY_FILESYSTEM_ACCESS_STRATEGY
The filesystem access strategy for the directory.Only available for the "local-filesystem" directory type.
Expects a
FileSystemAccessStrategyName
value, or a String representation of such value.Defaults to
LuceneIndexSettings.Defaults.DIRECTORY_FILESYSTEM_ACCESS_STRATEGY
.- See Also:
- Constant Field Values
-
IO_PREFIX
public static final String IO_PREFIX
The prefix for I/O-related property keys.- See Also:
- Constant Field Values
-
IO_STRATEGY
public static final String IO_STRATEGY
The I/O strategy, deciding how indexes are written to and read from.Expects a
IOStrategyName
value, or a String representation of such value.Defaults to
LuceneIndexSettings.Defaults.IO_STRATEGY
.- 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 "committed" and "searchable" automatic indexing 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 saving 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 "searchable" automatic indexing synchronization strategy 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 toIndexWriterConfig.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.
-
IO_WRITER_RAM_BUFFER_SIZE
public static final String IO_WRITER_RAM_BUFFER_SIZE
The value to pass toIndexWriterConfig.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.
-
IO_WRITER_INFOSTREAM
public static final String IO_WRITER_INFOSTREAM
Whether to log theIndexWriterConfig.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
orfalse
, or a String that can be parsed into such Boolean value.Default is
false
.
-
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 toLogMergePolicy.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.
-
IO_MERGE_FACTOR
public static final String IO_MERGE_FACTOR
The value to pass toLogMergePolicy.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.
-
IO_MERGE_MIN_SIZE
public static final String IO_MERGE_MIN_SIZE
The value to pass toLogByteSizeMergePolicy.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.
-
IO_MERGE_MAX_SIZE
public static final String IO_MERGE_MAX_SIZE
The value to pass toLogByteSizeMergePolicy.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.
-
IO_MERGE_MAX_FORCED_SIZE
public static final String IO_MERGE_MAX_FORCED_SIZE
The value to pass toLogByteSizeMergePolicy.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.
-
IO_MERGE_CALIBRATE_BY_DELETES
public static final String IO_MERGE_CALIBRATE_BY_DELETES
The value to pass toLogMergePolicy.setCalibrateSizeByDeletes(boolean)
.Expects a Boolean value such as
true
orfalse
, or a String that can be parsed into such Boolean value.The default for this setting is defined by Lucene.
-
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
orshards.1.<some shard-scoped property> = bar
orshards.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 to such integer value.
Defaults to
LuceneIndexSettings.Defaults.INDEXING_QUEUE_COUNT
.See the reference documentation, section "Lucene backend - Indexing", for more information about this setting and its implications.
- 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 to such integer value.
Defaults to
LuceneIndexSettings.Defaults.INDEXING_QUEUE_SIZE
.See the reference documentation, section "Lucene backend - Indexing", for more information about this setting and its implications.
- 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
-
-