public interface MassIndexer
| Modifier and Type | Method and Description |
|---|---|
MassIndexer |
batchSizeToLoadObjects(int batchSize)
Sets the batch size used to load the root entities.
|
MassIndexer |
cacheMode(CacheMode cacheMode)
Sets the cache interaction mode for the data loading tasks.
|
MassIndexer |
dropAndCreateSchemaOnStart(boolean dropAndCreateSchema)
Drops the indexes and their schema (if they exist) and re-creates them before indexing.
|
MassIndexer |
failureHandler(MassIndexingFailureHandler failureHandler)
Sets the
MassIndexingFailureHandler. |
MassIndexer |
idFetchSize(int idFetchSize)
Specifies the fetch size to be used when loading primary keys
if objects to be indexed.
|
MassIndexer |
limitIndexedObjectsTo(long maximum)
Stops indexing after having indexed a set amount of objects.
|
MassIndexer |
mergeSegmentsAfterPurge(boolean enable)
Merges each index into a single segment after the initial index purge, just before indexing.
|
MassIndexer |
mergeSegmentsOnFinish(boolean enable)
Merges each index into a single segment after indexing.
|
MassIndexer |
monitor(MassIndexingMonitor monitor)
Sets the
MassIndexingMonitor. |
MassIndexer |
purgeAllOnStart(boolean purgeAll)
Removes all entities from the indexes before indexing.
|
CompletableFuture<?> |
start()
Starts the indexing process in background (asynchronous).
|
void |
startAndWait()
Starts the indexing process, and then block until it's finished.
|
MassIndexer |
threadsToLoadObjects(int numberOfThreads)
Sets the number of threads to be used to load
the root entities.
|
MassIndexer |
transactionTimeout(int timeoutInSeconds)
Timeout of transactions for loading ids and entities to be re-indexed.
|
MassIndexer |
typesToIndexInParallel(int threadsToIndexObjects)
Sets the number of entity types to be indexed in parallel.
|
MassIndexer typesToIndexInParallel(int threadsToIndexObjects)
Defaults to 1.
threadsToIndexObjects - number of entity types to be indexed in parallelthis for method chainingMassIndexer threadsToLoadObjects(int numberOfThreads)
numberOfThreads - the number of threadsthis for method chainingMassIndexer batchSizeToLoadObjects(int batchSize)
batchSize - the batch sizethis for method chainingMassIndexer cacheMode(CacheMode cacheMode)
Defaults to CacheMode.IGNORE.
cacheMode - the cache interaction modethis for method chainingMassIndexer mergeSegmentsOnFinish(boolean enable)
Defaults to false.
enable - true to enable this operation, false to disable it.this for method chainingMassIndexer mergeSegmentsAfterPurge(boolean enable)
Defaults to true.
This setting has no effect if purgeAllOnStart is set to false.
enable - true to enable this operation, false to disable it.this for method chainingMassIndexer dropAndCreateSchemaOnStart(boolean dropAndCreateSchema)
Indexes will be unavailable for a short time during the dropping and re-creation, so this should only be used when failures of concurrent operations on the indexes (automatic indexing, ...) are acceptable.
This should be used when the existing schema is known to be obsolete, for example when the Hibernate Search mapping changed and some fields now have a different type, a different analyzer, new capabilities (projectable, ...), etc.
This may also be used when the schema is up-to-date,
since it can be faster than a purge on large indexes.
Defaults to false.
dropAndCreateSchema - if true the indexes and their schema will be dropped then re-created before starting the indexingthis for method chainingMassIndexer purgeAllOnStart(boolean purgeAll)
Set this to false only if you know there are no entities in the indexes: otherwise search results may be duplicated.
Defaults to true.
purgeAll - if true all entities will be removed from the indexes before starting the indexingthis for method chaining@Incubating MassIndexer limitIndexedObjectsTo(long maximum)
As a results the indexes will not be consistent with the database: use only for testing on an (undefined) subset of database data.
maximum - the maximum number of objects to indexthis for method chainingCompletableFuture<?> start()
May only be called once.
void startAndWait()
throws InterruptedException
May only be called once.
InterruptedException - if the current thread is interrupted
while waiting.MassIndexer idFetchSize(int idFetchSize)
Some databases accept special values,
for example MySQL might benefit from using Integer.MIN_VALUE
otherwise it will attempt to preload everything in memory.
idFetchSize - the fetch size to be used when loading primary keysthis for method chainingMassIndexer transactionTimeout(int timeoutInSeconds)
Specify a timeout which is long enough to load and index all entities of the type with the most instances, taking into account the configured batch size and number of threads to load objects.
Only supported in JTA-compatible environments.
timeoutInSeconds - the transaction timeout in seconds; If no value is given, the global default timeout of
the JTA environment applies.this for method chainingMassIndexer monitor(MassIndexingMonitor monitor)
MassIndexingMonitor.
The default monitor just logs the progress.
monitor - The monitor that will track mass indexing progress.this for method chainingMassIndexer failureHandler(MassIndexingFailureHandler failureHandler)
MassIndexingFailureHandler.
The default handler just forwards failures to the
background failure handler.
failureHandler - The handler for failures occurring during mass indexing.this for method chainingCopyright © 2006-2020 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.