Class MassIndexingJob.ParametersBuilder
- Enclosing class:
- MassIndexingJob
hibernate-search-mass-indexing.xml
.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Build the parameters.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 the 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.reindexOnly
(String hql, Map<String, ?> parameters) Use a JPQL/HQL conditional expression to limit the entities to be re-indexed.rowsPerPartition
(int rowsPerPartition) The maximum number of rows to process per partition.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
-
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 the database.The value defined must be greater than 0, and equal to or less than the value of
checkpointInterval
.This is an optional parameter, its default value is
MassIndexingJobParameters.Defaults.ENTITY_FETCH_SIZE_RAW
, or the value ofcheckpointInterval
if it is smaller.- 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
-
reindexOnly
Use a JPQL/HQL conditional expression to limit the entities to be re-indexed.The letter
e
is supposed to be used here as query alias. For instance a valid expression could be the following:manager.level < 2
... to filter instances that have a manager whose level is strictly less than 2.Parameters can be used, so assuming the parameter "max" is defined in the
parameters
Map
, this is valid as well:manager.level < :max
... to filter instances that have a manager whose level is strictly less than:max
.- Parameters:
hql
- A JPQL/HQL conditional expression, e.g.manager.level < 2
parameters
- A map of named parameters parameters that may be used in the conditional expression with the usual JPQL/HQL colon-prefixed syntax (e.g. ":myparam").- 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.
-