Class PojoIndexingPlanImpl
- All Implemented Interfaces:
PojoReindexingAssociationInverseSideCollector,PojoReindexingCollector,PojoIndexingProcessorRootContext,PojoLoadingPlanProvider,PojoIndexingPlan
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<PojoRawTypeIdentifier<?>,PojoContainedTypeIndexingPlan<?, ?>> protected final Map<PojoRawTypeIdentifier<?>,PojoIndexedTypeIndexingPlan<?, ?>> -
Constructor Summary
ConstructorsConstructorDescriptionPojoIndexingPlanImpl(PojoWorkTypeContextProvider typeContextProvider, PojoWorkSessionContext sessionContext, org.hibernate.search.mapper.pojo.work.impl.PojoIndexingPlanStrategy strategy) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Deprecated.voidaddOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Deprecated.voidaddOrUpdateOrDelete(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Deprecated.voiddelete(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Deprecated.voiddiscard()Discard all plans of indexing.voidDiscard all plans of indexing, except for parts that were alreadyprocessed.executeAndReport(OperationSubmitter operationSubmitter) Write all pending changes to the index now, without waiting for a Hibernate ORM flush event or transaction commit, and clear the plan so that it can be re-used.booleanvoidprocess()Extract all data from objects passed to the indexing plan so far, create documents to be indexed and put them into an internal buffer, without writing them to the indexes.org.hibernate.search.mapper.pojo.work.impl.AbstractPojoTypeIndexingPlan<?,?, ?> typeIfIncludedOrNull(PojoRawTypeIdentifier<?> typeIdentifier) voidupdateAssociationInverseSide(PojoRawTypeIdentifier<?> typeIdentifier, BitSet dirtyAssociationPaths, Object[] oldState, Object[] newState) Deprecated.voidupdateBecauseOfContained(PojoRawTypeIdentifier<?> typeIdentifier, Object containingEntity) voidupdateBecauseOfContainedAssociation(PojoRawTypeIdentifier<?> typeIdentifier, Object containingEntity, int dirtyAssociationPathOrdinal)
-
Field Details
-
indexedTypeDelegates
-
containedTypeDelegates
protected final Map<PojoRawTypeIdentifier<?>,PojoContainedTypeIndexingPlan<?, containedTypeDelegates?>>
-
-
Constructor Details
-
PojoIndexingPlanImpl
public PojoIndexingPlanImpl(PojoWorkTypeContextProvider typeContextProvider, PojoWorkSessionContext sessionContext, org.hibernate.search.mapper.pojo.work.impl.PojoIndexingPlanStrategy strategy)
-
-
Method Details
-
add
@Deprecated public void add(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Deprecated.Description copied from interface:PojoIndexingPlanAdd an entity to the index, assuming that the entity is absent from the index.Note: depending on the backend, this may lead to errors or duplicate entries in the index if the entity was actually already present in the index before this call. When in doubt, you should rather use
PojoIndexingPlan.addOrUpdate(PojoRawTypeIdentifier, Object, DocumentRoutesDescriptor, Object, boolean, boolean, BitSet).- Specified by:
addin interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type.providedId- A value to extract the document ID from. Generally the expected value is the entity ID, but a different value may be expected depending on the mapping. Ifnull, Hibernate Search will attempt to extract the ID from the entity.providedRoutes- The route to the current index shard. Only required if custom routing is enabled and theRoutingBridgeis missing. If aRoutingBridgeis assigned to the entity type, the routes will be computed using that bridge instead, and provided routes will be ignored.entity- The entity to add to the index.
-
addOrUpdate
@Deprecated public void addOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Deprecated.Description copied from interface:PojoIndexingPlanConsider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths,forceSelfDirtyandforceContainingDirty.- Specified by:
addOrUpdatein interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type.providedId- A value to extract the document ID from. Generally the expected value is the entity ID, but a different value may be expected depending on the mapping. Ifnull, Hibernate Search will attempt to extract the ID from the entity.providedRoutes- The routes to the current and previous index shards. Only required if custom routing is enabled and theRoutingBridgeis missing or unable to provide all the correct previous routes. If aRoutingBridgeis assigned to the entity type, the routes will be computed using that bridge instead, and provided routes (current and previous) will all be appended to the generated "previous routes".entity- The entity to update in the index.forceSelfDirty- Iftrue, forces reindexing of this entity regardless of the dirty paths.forceContainingDirty- Iftrue, forces the resolution of containing entities as dirty regardless of the dirty paths.dirtyPaths- The paths to consider dirty, as aBitSet. You can build such aBitSetby obtaining thedirty filterfor the entity type and calling one of thefiltermethods.
-
delete
@Deprecated public void delete(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Deprecated.Description copied from interface:PojoIndexingPlanDelete an entity from the index.Entities to reindex as a result of this operation will not be resolved.
No effect on the index if the entity is not in the index.
- Specified by:
deletein interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type.providedId- A value to extract the document ID from. Generally the expected value is the entity ID, but a different value may be expected depending on the mapping. If the provided ID isnull, Hibernate Search will attempt to extract the ID from the entity (which must be non-nullin that case).providedRoutes- The routes to the current and previous index shards. Only required if custom routing is enabled andentityis null, or theRoutingBridgeis missing or unable to provide all the correct previous routes. If aRoutingBridgeis assigned to the entity type, andentityis non-null, the routes will be computed using that bridge instead, and provided routes (current and previous) will all be appended to the generated "previous routes".entity- The entity to delete from the index. May benullifprovidedIdis non-null.
-
addOrUpdateOrDelete
@Deprecated public void addOrUpdateOrDelete(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Deprecated.Description copied from interface:PojoIndexingPlanConsider an entity added, updated, or deleted, depending on the result of loading it by ID, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths,forceSelfDirtyandforceContainingDirty.- Specified by:
addOrUpdateOrDeletein interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type.providedId- A value to extract the document ID from. Generally the expected value is the entity ID, but a different value may be expected depending on the mapping.providedRoutes- The routes to the current and previous index shards. Only required if custom routing is enabled and theRoutingBridgeis missing or unable to provide all the correct previous routes. If aRoutingBridgeis assigned to the entity type, the routes will be computed using that bridge instead, and provided routes (current and previous) will all be appended to the generated "previous routes".forceSelfDirty- Iftrue, forces reindexing of this entity regardless of the dirty paths.forceContainingDirty- Iftrue, forces the resolution of containing entities as dirty.dirtyPaths- The paths to consider dirty, as aBitSet. You can build such aBitSetby obtaining thedirty filterfor the entity type and calling one of thefiltermethods.
-
updateAssociationInverseSide
@Deprecated public void updateAssociationInverseSide(PojoRawTypeIdentifier<?> typeIdentifier, BitSet dirtyAssociationPaths, Object[] oldState, Object[] newState) Deprecated.Description copied from interface:PojoIndexingPlanConsider an association updated with the given entities removed, and perform reindexing of the relevant entities on the inverse side of that association as necessary.This is mostly useful for cases where callers do not receive update events for associations on both sides, to have Hibernate Search act "as if" the inverse side of the association had been updated.
WARNING: Getters returning the current state of the association on the removed entities are still expected to return the updated state of the association (for example through lazy-loading). Failing that, reindexing will index out-of-date information.
- Specified by:
updateAssociationInverseSidein interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type on one side of the association.dirtyAssociationPaths- The association paths to consider dirty, as aBitSet. You can build such aBitSetby obtaining thedirty association filterfor the entity type and calling one of thefiltermethods.oldState- The old state of the entity whose associations are dirty. May benull, in which case this state will not yield any reindexing.newState- The new state of the entity whose associations are dirty. May benull, in which case this state will not yield any reindexing.
-
typeIfIncludedOrNull
public org.hibernate.search.mapper.pojo.work.impl.AbstractPojoTypeIndexingPlan<?,?, typeIfIncludedOrNull?> (PojoRawTypeIdentifier<?> typeIdentifier) - Specified by:
typeIfIncludedOrNullin interfacePojoIndexingPlan- Parameters:
typeIdentifier- The identifier of the entity type.- Returns:
- The indexing plan for the given entity type,
or
nullif that type is going to be ignored by this indexing plan.
-
process
public void process()Description copied from interface:PojoIndexingPlanExtract all data from objects passed to the indexing plan so far, create documents to be indexed and put them into an internal buffer, without writing them to the indexes.In particular, ensure that all data is extracted from the POJOs and converted to the backend-specific format.
Calling this method is optional: the
PojoIndexingPlan.executeAndReport(OperationSubmitter)method will perform the processing if necessary.- Specified by:
processin interfacePojoIndexingPlan
-
executeAndReport
public CompletableFuture<MultiEntityOperationExecutionReport> executeAndReport(OperationSubmitter operationSubmitter) Description copied from interface:PojoIndexingPlanWrite all pending changes to the index now, without waiting for a Hibernate ORM flush event or transaction commit, and clear the plan so that it can be re-used.- Specified by:
executeAndReportin interfacePojoIndexingPlan- Returns:
- A
CompletableFuturethat will be completed with an execution report when all the works are complete.
-
discard
public void discard()Description copied from interface:PojoIndexingPlanDiscard all plans of indexing.- Specified by:
discardin interfacePojoIndexingPlan
-
discardNotProcessed
public void discardNotProcessed()Description copied from interface:PojoIndexingPlanDiscard all plans of indexing, except for parts that were alreadyprocessed.- Specified by:
discardNotProcessedin interfacePojoIndexingPlan
-
updateBecauseOfContained
public void updateBecauseOfContained(PojoRawTypeIdentifier<?> typeIdentifier, Object containingEntity) - Specified by:
updateBecauseOfContainedin interfacePojoReindexingCollector
-
updateBecauseOfContainedAssociation
public void updateBecauseOfContainedAssociation(PojoRawTypeIdentifier<?> typeIdentifier, Object containingEntity, int dirtyAssociationPathOrdinal) - Specified by:
updateBecauseOfContainedAssociationin interfacePojoReindexingAssociationInverseSideCollector
-
sessionContext
- Specified by:
sessionContextin interfacePojoIndexingProcessorRootContext
-
isDeleted
- Specified by:
isDeletedin interfacePojoIndexingProcessorRootContext- Parameters:
unproxiedObject- An object that was already unproxied usingPojoRuntimeIntrospector.unproxy(Object).- Returns:
trueif this object is an entity and is considered deleted in the current context,falseotherwise.
-
loadingPlan
- Specified by:
loadingPlanin interfacePojoLoadingPlanProvider
-