Package org.hibernate.search.impl
Class MassIndexerImpl
java.lang.Object
org.hibernate.search.impl.MassIndexerImpl
- All Implemented Interfaces:
MassIndexer
Prepares and configures a BatchIndexingWorkspace to start rebuilding
the indexes for all entity instances in the database.
The type of these entities is either all indexed entities or a
subset, always including all subtypes.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedMassIndexerImpl(SearchFactoryImplementor searchFactory, org.hibernate.SessionFactory sessionFactory, Class<?>... entities) -
Method Summary
Modifier and TypeMethodDescriptionbatchSizeToLoadObjects(int batchSize) Sets the batch size used to load the root entities.cacheMode(org.hibernate.CacheMode cacheMode) Sets the cache interaction mode for the data loading tasks.protected BatchCoordinatorlimitIndexedObjectsTo(long maximum) EXPERIMENTAL method: will probably change Will stop indexing after having indexed a set amount of objects.optimizeAfterPurge(boolean optimize) If index optimization should be run before starting, after the purgeAll.optimizeOnFinish(boolean optimize) If index optimization has to be started at the end of the indexing process.Override the defaultMassIndexerProgressMonitor.purgeAllOnStart(boolean purgeAll) If all entities should be removed from the index before starting using purgeAll.Future<?> start()Starts the indexing process in background (asynchronous).voidStarts the indexing process, and then block until it's finished.threadsForIndexWriter(int numberOfThreads) Sets the number of threads to be used to analyze the documents and write to the index.threadsForSubsequentFetching(int numberOfThreads) Sets the number of threads used to load the lazy collections related to the indexed entities.threadsToLoadObjects(int numberOfThreads) Set the number of threads to be used to load the root entities.
-
Field Details
-
rootEntities
-
-
Constructor Details
-
MassIndexerImpl
protected MassIndexerImpl(SearchFactoryImplementor searchFactory, org.hibernate.SessionFactory sessionFactory, Class<?>... entities)
-
-
Method Details
-
cacheMode
Description copied from interface:MassIndexerSets the cache interaction mode for the data loading tasks. Defaults to CacheMode.IGNORE.- Specified by:
cacheModein interfaceMassIndexer- Returns:
- this for method chaining
-
threadsToLoadObjects
Description copied from interface:MassIndexerSet the number of threads to be used to load the root entities.- Specified by:
threadsToLoadObjectsin interfaceMassIndexer- Parameters:
numberOfThreads-- Returns:
- this for method chaining
-
batchSizeToLoadObjects
Description copied from interface:MassIndexerSets the batch size used to load the root entities.- Specified by:
batchSizeToLoadObjectsin interfaceMassIndexer- Parameters:
batchSize-- Returns:
- this for method chaining
-
threadsForSubsequentFetching
Description copied from interface:MassIndexerSets the number of threads used to load the lazy collections related to the indexed entities.- Specified by:
threadsForSubsequentFetchingin interfaceMassIndexer- Parameters:
numberOfThreads-- Returns:
- this for method chaining
-
threadsForIndexWriter
Description copied from interface:MassIndexerSets the number of threads to be used to analyze the documents and write to the index.
This overrides the global property hibernate.search.batchbackend.concurrent_writers.
Might be ignored by
BatchBackendimplementations other thanorg.hibernate.search.backend.impl.batchlucene.LuceneBatchBackend- Specified by:
threadsForIndexWriterin interfaceMassIndexer- Parameters:
numberOfThreads-- Returns:
- this for method chaining
- See Also:
-
progressMonitor
Description copied from interface:MassIndexerOverride the defaultMassIndexerProgressMonitor.- Specified by:
progressMonitorin interfaceMassIndexer- Parameters:
monitor- this instance will receive updates about the massindexing progress.- Returns:
- this for method chaining
-
optimizeOnFinish
Description copied from interface:MassIndexerIf index optimization has to be started at the end of the indexing process. Defaults to true.- Specified by:
optimizeOnFinishin interfaceMassIndexer- Parameters:
optimize-- Returns:
- this for method chaining
-
optimizeAfterPurge
Description copied from interface:MassIndexerIf index optimization should be run before starting, after the purgeAll. Has no effect if purgeAll is set to false. Defaults to true.- Specified by:
optimizeAfterPurgein interfaceMassIndexer- Parameters:
optimize-- Returns:
- this for method chaining
-
purgeAllOnStart
Description copied from interface:MassIndexerIf all entities should be removed from the index before starting using purgeAll. Set it to false only if you know there are no entities in the index: otherwise search results may be duplicated. Defaults to true.- Specified by:
purgeAllOnStartin interfaceMassIndexer- Parameters:
purgeAll-- Returns:
- this for method chaining
-
start
Description copied from interface:MassIndexerStarts the indexing process in background (asynchronous). Can be called only once.- Specified by:
startin interfaceMassIndexer- Returns:
- a Future to control task canceling. get() will block until completion. cancel() is currently not implemented.
-
startAndWait
Description copied from interface:MassIndexerStarts the indexing process, and then block until it's finished. Can be called only once.- Specified by:
startAndWaitin interfaceMassIndexer- Throws:
InterruptedException- if the current thread is interrupted while waiting.
-
createCoordinator
-
limitIndexedObjectsTo
Description copied from interface:MassIndexerEXPERIMENTAL method: will probably change Will stop indexing after having indexed a set amount of objects. As a results the index will not be consistent with the database: use only for testing on an (undefined) subset of database data.- Specified by:
limitIndexedObjectsToin interfaceMassIndexer- Parameters:
maximum-- Returns:
-