public interface PojoIndexingPlan
This class is stateful: it queues operations internally to apply them at a later time.
When process() is called,
the entities will be processed and index documents will be built
and stored in an internal buffer.
When executeAndReport() is called,
the operations will be actually sent to the index.
Note that executeAndReport() will implicitly trigger processing of documents that weren't processed yet,
if any, so calling process() is not necessary if you call executeAndReport() just next.
Implementations may not be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
void |
add(PojoRawTypeIdentifier<?> typeIdentifier,
Object providedId,
Object entity)
Add an entity to the index, assuming that the entity is absent from the index.
|
void |
addOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier,
Object providedId,
Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
addOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier,
Object providedId,
Object entity,
String... dirtyPaths)
Update an entity in the index, or add it if it's absent from the index,
but try to avoid reindexing if the given dirty paths
are known not to impact the indexed form of that entity.
|
void |
delete(PojoRawTypeIdentifier<?> typeIdentifier,
Object providedId,
Object entity)
Delete an entity from the index.
|
void |
discard()
Discard all plans of indexing.
|
void |
discardNotProcessed()
Discard all plans of indexing, except for parts that were already
processed. |
CompletableFuture<IndexIndexingPlanExecutionReport> |
executeAndReport()
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.
|
void |
process()
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.
|
void |
purge(PojoRawTypeIdentifier<?> typeIdentifier,
Object providedId)
Purge an entity from the index.
|
void add(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, Object entity)
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(PojoRawTypeIdentifier, Object, Object).
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 null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to add to the index.void addOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, Object entity)
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 null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to update in the index.void addOrUpdate(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, Object entity, String... dirtyPaths)
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 null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to update in the index.dirtyPaths - The paths to consider dirty, formatted using the dot-notation
("directEntityProperty.nestedPropery").void delete(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId, Object entity)
No effect on the index if the entity is not in the index.
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 null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to delete from the index.void purge(PojoRawTypeIdentifier<?> typeIdentifier, Object providedId)
Entities to reindex as a result from this operation will not be resolved.
No effect on the index if the entity is not in the index.
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.void process()
In particular, ensure that all data is extracted from the POJOs and converted to the backend-specific format.
Calling this method is optional: the executeAndReport() method
will perform the processing if necessary.
CompletableFuture<IndexIndexingPlanExecutionReport> executeAndReport()
CompletableFuture that will be completed with an execution report when all the works are complete.void discard()
void discardNotProcessed()
processed.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.