Class MassIndexingJob.ParametersBuilder
- Enclosing class:
- MassIndexingJob
hibernate-search-mass-indexing.xml
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the parameters.cacheMode
(org.hibernate.CacheMode cacheMode) The HibernateCacheMode
when loading entities.checkpointInterval
(int checkpointInterval) The number of entities to process before triggering the next checkpoint.entityFetchSize
(int entityFetchSize) Specifies the fetch size to be used when loading entities from database.entityManagerFactoryNamespace
(String namespace) The string that allows to select how you want to reference theEntityManagerFactory
.entityManagerFactoryReference
(String reference) The string that will identify theEntityManagerFactory
.idFetchSize
(int idFetchSize) Specifies the fetch size to be used when loading primary keys at the step-level.maxResultsPerEntity
(int maxResultsPerEntity) The maximum number of results to load per entity type.maxThreads
(int maxThreads) The maximum number of threads to use for processing the job.mergeSegmentsAfterPurge
(boolean mergeSegmentsAfterPurge) Specify whether the mass indexer should merge segments at the beginning of the job.mergeSegmentsOnFinish
(boolean mergeSegmentsOnFinish) Specify whether the mass indexer should merge segments at the end of the job.purgeAllOnStart
(boolean purgeAllOnStart) Specify whether the existing lucene index should be purged at the beginning of the job.restrictedBy
(String hql) Use HQL / JPQL to index entities of a target entity type.rowsPerPartition
(int rowsPerPartition) The maximum number of rows to process per partition.sessionClearInterval
(int sessionClearInterval) The number of entities to process before clearing the session.Define the tenant ID for the job execution.
-
Method Details
-
entityManagerFactoryNamespace
The string that allows to select how you want to reference theEntityManagerFactory
. Possible values are:persistence-unit-name
(the default): use the persistence unit name defined inpersistence.xml
.session-factory-name
: use the session factory name defined in the Hibernate configuration by thehibernate.session_factory_name
configuration property.
- Parameters:
namespace
- the name of namespace to use- Returns:
- itself
-
entityManagerFactoryReference
The string that will identify theEntityManagerFactory
. This method is required if there's more than one persistence unit.- Parameters:
reference
- the name of reference- Returns:
- itself
-
cacheMode
The HibernateCacheMode
when loading entities.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.CACHE_MODE
.- Parameters:
cacheMode
- the cache mode- Returns:
- itself
-
sessionClearInterval
The number of entities to process before clearing the session. The value defined must be greater than 0, and equal to or less than the value ofcheckpointInterval
.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.SESSION_CLEAR_INTERVAL_DEFAULT_RAW
, or the value ofcheckpointInterval
if it is smaller.- Parameters:
sessionClearInterval
- the number of entities to process before clearing the session.- Returns:
- itself
-
checkpointInterval
The number of entities to process before triggering the next checkpoint. The value defined must be greater than 0, and equal to or less than the value ofrowsPerPartition
.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.CHECKPOINT_INTERVAL_DEFAULT_RAW
, or the value ofrowsPerPartition
if it is smaller.- Parameters:
checkpointInterval
- the number of entities to process before triggering the next checkpoint.- Returns:
- itself
-
idFetchSize
Specifies the fetch size to be used when loading primary keys at the step-level. Some databases accept special values, for example MySQL might benefit from usingInteger.MIN_VALUE
, otherwise it will attempt to preload everything in memory.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.ID_FETCH_SIZE
.- Parameters:
idFetchSize
- the fetch size to be used when loading primary keys- Returns:
- itself
-
entityFetchSize
Specifies the fetch size to be used when loading entities from database. Some databases accept special values, for example MySQL might benefit from usingInteger.MIN_VALUE
, otherwise it will attempt to preload everything in memory.This is an optional parameter, its default value is the value of the session clear interval.
- Parameters:
entityFetchSize
- the fetch size to be used when loading entities- Returns:
- itself
-
maxResultsPerEntity
The maximum number of results to load per entity type. This parameter let you define a threshold value to avoid loading too many entities accidentally. The value defined must be greater than 0. The parameter is not used by default. It is equivalent to keyword LIMIT in SQL.- Parameters:
maxResultsPerEntity
- the maximum number of results returned per entity type.- Returns:
- itself
-
maxThreads
The maximum number of threads to use for processing the job. Note the batch runtime cannot guarantee the request number of threads are available; it will use as many as it can up to the request maximum.This is an optional parameter, its default value is the number of partitions.
- Parameters:
maxThreads
- the maximum number of threads.- Returns:
- itself
-
mergeSegmentsAfterPurge
Specify whether the mass indexer should merge segments at the beginning of the job. This operation takes place after the purge operation and before indexing.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.MERGE_SEGMENTS_AFTER_PURGE
.- Parameters:
mergeSegmentsAfterPurge
- merge segments after purge.- Returns:
- itself
-
mergeSegmentsOnFinish
Specify whether the mass indexer should merge segments at the end of the job. This operation takes place after indexing.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.MERGE_SEGMENTS_ON_FINISH
.- Parameters:
mergeSegmentsOnFinish
- merge segments on finish.- Returns:
- itself
-
purgeAllOnStart
Specify whether the existing lucene index should be purged at the beginning of the job. This operation takes place before indexing.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.PURGE_ALL_ON_START
.- Parameters:
purgeAllOnStart
- purge all on start.- Returns:
- itself
-
restrictedBy
Use HQL / JPQL to index entities of a target entity type. Your query should contain only one entity type. Mixing this approach with the criteria restriction is not allowed. Please notice that there's no query validation for your input.- Parameters:
hql
- HQL / JPQL.- Returns:
- itself
-
rowsPerPartition
The maximum number of rows to process per partition. The value defined must be greater than 0, and greater than the value ofcheckpointInterval
.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.ROWS_PER_PARTITION
.- Parameters:
rowsPerPartition
- Rows per partition.- Returns:
- itself
-
tenantId
Define the tenant ID for the job execution.- Parameters:
tenantId
- Tenant ID. Null or empty value is not allowed.- Returns:
- itself
-
build
Build the parameters.- Returns:
- the parameters.
- Throws:
SearchException
- if the serialization of some parameters fail.
-