org.hibernate.search.indexes.interceptor

## Interface EntityIndexingInterceptor<T>

- All Known Implementing Classes:
    DontInterceptEntityInterceptor

      public interface EntityIndexingInterceptor<T>

  This interceptor is called upon indexing operations to optionally change the indexing behavior.

  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` and `purgeAll`.

  Implementations must be thread-safe and should have a no-arg constructor.

  Typical use cases include the so called soft delete.

  Author:
    Emmanuel Bernard

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `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.
    `IndexingOverride` | `onDelete(T entity)` Triggered when an entity instance T should be deleted from the index.
    `IndexingOverride` | `onUpdate(T entity)` Triggered when an entity instance T should be updated in the index.

- - ### Method Detail

    - #### 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-2017 Red Hat, Inc. All Rights Reserved