public interface PojoWorkPlan
Works are accumulated when methods such as add(Object)
or update(Object, Object)
are called,
and executed only when execute()
is called.
Relative ordering of works within a work plan will be preserved.
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 id,
Object entity)
Add an entity to the index, assuming that the entity is absent from the index.
|
void |
delete(Object entity)
Delete an entity from the index.
|
void |
delete(Object id,
Object entity)
Delete an entity from the index.
|
CompletableFuture<?> |
execute()
Start executing all the works in this plan, and clear the plan so that it can be re-used.
|
void |
prepare()
Prepare the work plan execution, i.e.
|
void |
update(Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
update(Object id,
Object entity)
Update an entity in the index, or add it if it's absent from the index.
|
void |
update(Object id,
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 |
update(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 add(Object entity)
Shorthand for add(null, entity)
; see add(Object, Object)
.
entity
- The entity to add to the index.void add(Object id, 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 update(Object, Object)
or update(Object)
.
id
- The provided ID for the entity.
If null
, Hibernate Search will attempt to extract the ID from the entity.entity
- The entity to add to the index.void update(Object entity)
Shorthand for update(null, entity)
; see update(Object, Object)
.
entity
- The entity to update in the index.void update(Object id, Object entity)
id
- The provided ID for the entity.
If null
, Hibernate Search will attempt to extract the ID from the entity.entity
- The entity to update in the index.void update(Object entity, String... dirtyPaths)
Assumes that the entity may already be present in the index.
Shorthand for update(null, entity, dirtyPaths)
; see update(Object, Object)
.
entity
- The entity to update in the index.dirtyPaths
- The paths to consider dirty, formatted using the dot-notation
("directEntityProperty.nestedPropery").void update(Object id, Object entity, String... dirtyPaths)
id
- The provided ID for the entity.
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 id, Object entity)
No effect on the index if the entity is not in the index.
id
- The provided ID for the entity.
If null
, Hibernate Search will attempt to extract the ID from the entity.entity
- The entity to delete from the index.void prepare()
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 preparation if necessary.
CompletableFuture<?> execute()
CompletableFuture
that will be completed when all the works are complete.Copyright © 2006-2019 Red Hat, Inc. and others. Licensed under the GNU Lesser General Public License (LGPL), version 2.1 or later.