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 execute() is called,
the operations will be actually sent to the index.
Note that execute() will implicitly trigger processing of documents that weren't processed yet,
if any, so calling process() is not necessary if you call execute() just next.
Implementations may not be thread-safe.
| Modifier and Type | Method and Description |
|---|---|
void |
add(Object entity)
Add an entity to the index, assuming that the entity is absent from the index.
|
void |
add(Object providedId,
Object entity)
Add an entity to the index, assuming that the entity is 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 providedId,
Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
addOrUpdate(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 |
addOrUpdate(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(Object entity)
Delete an entity from the index.
|
void |
delete(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<?> |
execute()
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(Class<?> clazz,
Object providedId)
Purge an entity from the index.
|
void add(Object entity)
Shorthand for add(null, entity); see add(Object, Object).
entity - The entity to add to the index.void add(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(Object, Object) or addOrUpdate(Object).
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(Object entity)
Shorthand for update(null, entity); see addOrUpdate(Object, Object).
entity - The entity to update in the index.void addOrUpdate(Object providedId, Object entity)
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(Object entity, String... dirtyPaths)
Assumes that the entity may already be present in the index.
Shorthand for update(null, entity, dirtyPaths); see addOrUpdate(Object, Object).
entity - The entity to update in the index.dirtyPaths - The paths to consider dirty, formatted using the dot-notation
("directEntityProperty.nestedPropery").void addOrUpdate(Object providedId, Object entity, String... dirtyPaths)
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(Object entity)
Shorthand for delete(null, entity); see delete(Object, Object).
entity - The entity to delete from the index.void delete(Object providedId, Object entity)
No effect on the index if the entity is not 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.
If null, Hibernate Search will attempt to extract the ID from the entity.entity - The entity to delete from the index.void purge(Class<?> clazz, 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.
clazz - The type of the entity.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 execute() method
will perform the processing if necessary.
CompletableFuture<?> execute()
CompletableFuture that will be completed 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.