Class PojoContainedTypeIndexingPlan<I,E>
- Type Parameters:
I- The identifier type for the contained entity type.E- The contained entity type.
- All Implemented Interfaces:
PojoImplicitReindexingAssociationInverseSideResolverRootContext,ContainerExtractionContext,PojoTypeIndexingPlan
-
Constructor Summary
ConstructorsConstructorDescriptionPojoContainedTypeIndexingPlan(PojoWorkContainedTypeContext<I, E> typeContext, PojoWorkSessionContext sessionContext, PojoIndexingPlanImpl root, org.hibernate.search.mapper.pojo.work.impl.PojoTypeIndexingPlanDelegate<I, E> delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Add an entity to the index, assuming that the entity is absent from the index.voidaddOrUpdate(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths,forceSelfDirtyandforceContainingDirty.voidaddOrUpdateOrDelete(Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Consider 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.protected PojoContainedTypeIndexingPlan<I,E>.org.hibernate.search.mapper.pojo.work.impl.PojoContainedTypeIndexingPlan.ContainedEntityState createState(I identifier) voiddelete(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Delete an entity from the index.detectContainingEntityType(Object containingEntity) voidPropagates (rethrows) aRuntimeExceptionthrown while extracting elements from a container, or ignores it so that the container is assumed empty.voidPropagates (rethrows) aRuntimeExceptionthrown while accessing a property (getter or field access), or ignores it so that the property is skipped.voidupdateAssociationInverseSide(BitSet dirtyAssociationPaths, Object[] oldState, Object[] newState) Consider an association updated with the given entities removed, and perform reindexing of the relevant entities on the inverse side of that association as necessary.
-
Constructor Details
-
PojoContainedTypeIndexingPlan
public PojoContainedTypeIndexingPlan(PojoWorkContainedTypeContext<I, E> typeContext, PojoWorkSessionContext sessionContext, PojoIndexingPlanImpl root, org.hibernate.search.mapper.pojo.work.impl.PojoTypeIndexingPlanDelegate<I, E> delegate)
-
-
Method Details
-
createState
protected PojoContainedTypeIndexingPlan<I,E>.org.hibernate.search.mapper.pojo.work.impl.PojoContainedTypeIndexingPlan.ContainedEntityState createState(I identifier) -
add
Description copied from interface:PojoTypeIndexingPlanAdd 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
PojoTypeIndexingPlan.addOrUpdate(Object, DocumentRoutesDescriptor, Object, boolean, boolean, BitSet).- Specified by:
addin interfacePojoTypeIndexingPlan- Parameters:
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
public void addOrUpdate(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Description copied from interface:PojoTypeIndexingPlanConsider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths,forceSelfDirtyandforceContainingDirty.- Specified by:
addOrUpdatein interfacePojoTypeIndexingPlan- Parameters:
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
Description copied from interface:PojoTypeIndexingPlanDelete 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 interfacePojoTypeIndexingPlan- Parameters:
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
public void addOrUpdateOrDelete(Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, BitSet dirtyPaths) Description copied from interface:PojoTypeIndexingPlanConsider 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 interfacePojoTypeIndexingPlan- Parameters:
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
public void updateAssociationInverseSide(BitSet dirtyAssociationPaths, Object[] oldState, Object[] newState) Description copied from interface:PojoTypeIndexingPlanConsider 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 interfacePojoTypeIndexingPlan- Parameters:
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.
-
runtimeIntrospector
- Specified by:
runtimeIntrospectorin interfacePojoImplicitReindexingAssociationInverseSideResolverRootContext
-
detectContainingEntityType
- Specified by:
detectContainingEntityTypein interfacePojoImplicitReindexingAssociationInverseSideResolverRootContext
-
propagateOrIgnoreContainerExtractionException
Description copied from interface:ContainerExtractionContextPropagates (rethrows) aRuntimeExceptionthrown while extracting elements from a container, or ignores it so that the container is assumed empty.- Specified by:
propagateOrIgnoreContainerExtractionExceptionin interfaceContainerExtractionContext- Parameters:
exception- ARuntimeExceptionthrown while extracting elements from a container.
-
propagateOrIgnorePropertyAccessException
Description copied from interface:PojoImplicitReindexingAssociationInverseSideResolverRootContextPropagates (rethrows) aRuntimeExceptionthrown while accessing a property (getter or field access), or ignores it so that the property is skipped.- Specified by:
propagateOrIgnorePropertyAccessExceptionin interfacePojoImplicitReindexingAssociationInverseSideResolverRootContext- Parameters:
exception- ARuntimeExceptionthrown while accessing a property.- See Also:
-