org.hibernate.search.indexes.interceptor
Interface EntityIndexingInterceptor<T>
- All Known Implementing Classes:
- DefaultEntityInterceptor, DontInterceptEntityInterceptor
public interface EntityIndexingInterceptor<T>
This interceptor is called upon indexing operations to optionally change the behavior.
Implementations must be thread safe and should have a no-arg constructor.
Typical use case include so called soft deletes.
The interceptor is applied to a MassIndexer operation, but is ignored when using
the explicit indexing control API such org.hibernate.search.FullTextSession.index(T)
or purge
, .
- Author:
- Emmanuel Bernard
onAdd
IndexingOverride onAdd(T entity)
- Triggered when an entity instance T should be added to the index, either by an event listener or by the
MassIndexer.
This is not triggered by an explicit API call such as FullTextSession.index(T).
- Parameters:
entity
- The entity instance
- Returns:
- Return
IndexingOverride.APPLY_DEFAULT
to have the instance be added to the index as normal; return a
different value to override the behaviour.
onUpdate
IndexingOverride onUpdate(T entity)
- Triggered when an entity instance T should be updated in the index.
- Parameters:
entity
- The entity instance
- Returns:
- Return
IndexingOverride.APPLY_DEFAULT
to have the instance removed and re-added to the index as
normal; return a different value to override the behaviour.
onDelete
IndexingOverride onDelete(T entity)
- Triggered when an entity instance T should be deleted from the index.
- Parameters:
entity
- The entity instance
- Returns:
- Return
IndexingOverride.APPLY_DEFAULT
to have the instance removed from the index as normal;
return a different value to override the behaviour.
onCollectionUpdate
IndexingOverride onCollectionUpdate(T entity)
- A CollectionUpdate event is fired on collections included in an indexed entity, for example when using
IndexedEmbedded
This event is triggered on each indexed domain instance T contained in such a collection;
this is generally similar to a onUpdate(Object)
event.
- Parameters:
entity
- The entity instance
- Returns:
- Return
IndexingOverride.APPLY_DEFAULT
to have the instance removed and re-added to the index as
normal; return a different value to override the behaviour.
Copyright © 2006-2013 Red Hat Middleware, LLC. All Rights Reserved