Interface SearchIndexingPlan
This class is stateful: it queues operations internally to apply them when the session is closed.
This contract is not thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(Class<?> entityClass, Object providedId, DocumentRoutesDescriptor providedRoutes) Add an entity to the index, assuming that the entity is absent from the index.void
Add an entity to the index, assuming that the entity is absent from the index.void
add
(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Add an entity to the index, assuming that the entity is absent from the index.void
addOrUpdate
(Class<?> entityClass, Object providedId, DocumentRoutesDescriptor providedRoutes) Update an entity in the index, or add it if it's absent from the index.void
addOrUpdate
(Object entity) Update an entity in the index, or add it if it's absent from the index.void
addOrUpdate
(Object entity, String... dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary.void
addOrUpdate
(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Update an entity in the index, or add it if it's absent from the index.void
addOrUpdate
(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, String... dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths
,forceSelfDirty
andforceContainingDirty
.void
addOrUpdate
(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, String... dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths
.void
addOrUpdateOrDelete
(Class<?> entityClass, Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, String... 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
,forceSelfDirty
andforceContainingDirty
.void
Delete an entity from the index.void
delete
(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity) Delete an entity from the index.void
purge
(Class<?> entityClass, Object providedId, DocumentRoutesDescriptor providedRoutes) Delete the entity from the index.
-
Method Details
-
add
Add an entity to the index, assuming that the entity is absent from the index.Shorthand for
add(null, null, entity)
; seeadd(Object, DocumentRoutesDescriptor, Object)
.- Parameters:
entity
- The entity to add to the index.
-
add
Add 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
addOrUpdate(Object, DocumentRoutesDescriptor, Object)
oraddOrUpdate(Object)
.- 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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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.
-
add
Add 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
addOrUpdate(Object, DocumentRoutesDescriptor, Object)
oraddOrUpdate(Object)
.- Parameters:
entityClass
- The class of the entity to add to the index.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 route to the current index shard. Only required if custom routing is enabled and theRoutingBridge
is missing. If aRoutingBridge
is 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".
-
addOrUpdate
Update an entity in the index, or add it if it's absent from the index.Shorthand for
addOrUpdate(null, null, entity)
; seeaddOrUpdate(Object, DocumentRoutesDescriptor, Object)
.- Parameters:
entity
- The entity to update in the index.
-
addOrUpdate
Update an entity in the index, or add it if it's absent from the index.- 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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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.
-
addOrUpdate
Update an entity in the index, or add it if it's absent from the index.- Parameters:
entityClass
- The class of the entity to update in the index.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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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".
-
addOrUpdate
Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary.Assumes that the entity may already be present in the index.
Shorthand for
addOrUpdate(null, null, entity, false, false, dirtyPaths)
; seeaddOrUpdate(Object, DocumentRoutesDescriptor, Object, boolean, boolean, String...)
.- Parameters:
entity
- The entity to update in the index.dirtyPaths
- The paths to consider dirty, formatted using the dot-notation ("directEntityProperty.nestedPropery").
-
addOrUpdate
void addOrUpdate(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, String... dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths
.Assumes that the entity may already be present in the index.
Shorthand for
addOrUpdate(providedId, providedRoutes, entity, false, false, dirtyPaths)
; seeaddOrUpdate(Object, DocumentRoutesDescriptor, Object, boolean, boolean, String...)
.- 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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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.dirtyPaths
- The paths to consider dirty, formatted using the dot-notation
-
addOrUpdate
void addOrUpdate(Object providedId, DocumentRoutesDescriptor providedRoutes, Object entity, boolean forceSelfDirty, boolean forceContainingDirty, String... dirtyPaths) Consider an entity updated, and perform reindexing of this entity as well as containing entities as necessary, taking into accountdirtyPaths
,forceSelfDirty
andforceContainingDirty
.Assumes that the entity may already be present in the index.
- 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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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, formatted using the dot-notation
-
delete
Delete an entity from the index.Shorthand for
delete(null, null, entity)
; seedelete(Object, DocumentRoutesDescriptor, Object)
.- Parameters:
entity
- The entity to delete from the index.
-
delete
Delete an entity from the index.No effect on the index if the entity is not in the index.
- 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 andentity
is null, or theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is assigned to the entity type, andentity
is 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.
-
purge
Delete the entity from the index.No effect on the index if the entity is not in the index.
On contrary to
delete(Object)
, if documents embed this entity (throughIndexedEmbedded
for example), these documents will not be re-indexed, leaving the indexes in an inconsistent state until they are re-indexed manually.- Parameters:
entityClass
- The class of the entity to delete from the index.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.- Throws:
SearchException
- If the entity type is not indexed directly (Indexed
).
-
addOrUpdateOrDelete
void addOrUpdateOrDelete(Class<?> entityClass, Object providedId, DocumentRoutesDescriptor providedRoutes, boolean forceSelfDirty, boolean forceContainingDirty, String... 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
,forceSelfDirty
andforceContainingDirty
.- Parameters:
entityClass
- The class of the entity to add, update or delete from the index.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 theRoutingBridge
is missing or unable to provide all the correct previous routes. If aRoutingBridge
is 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, formatted using the dot-notation
-