org.hibernate.search.jpa

## Interface FullTextEntityManager

- All Superinterfaces:
    javax.persistence.EntityManager
  All Known Subinterfaces:
    FullTextSession

      public interface FullTextEntityManager
      extends javax.persistence.EntityManager

  Extends an EntityManager with Full-Text operations
  Author:
    Emmanuel Bernard

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `FullTextQuery` | `createFullTextQuery(Query luceneQuery, Class<?>... entities)` Create a fulltext query on top of a native Lucene query returning the matching objects of type `entities` and their respective subclasses.
    `FullTextQuery` | `createFullTextQuery(QueryDescriptor descriptor, Class<?>... entities)` Creates a fulltext query from the given query descriptor.
    `MassIndexer` | `createIndexer(Class<?>... types)` Creates a MassIndexer to rebuild the indexes of some or all indexed entity types.
    `void` | `flushToIndexes()` Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.
    `SearchFactory` | `getSearchFactory()`
    `<T> void` | `index(T entity)` Force the (re)indexing of a given managed object.
    `<T> void` | `purge(Class<T> entityType, Serializable id)` Remove the entity with the type `entityType` and the identifier `id` from the index.
    `<T> void` | `purgeAll(Class<T> entityType)` Remove all entities from of particular class and all its subclasses from the index.

    - ### Methods inherited from interface javax.persistence.EntityManager

      `clear, close, contains, createEntityGraph, createEntityGraph, createNamedQuery, createNamedQuery, createNamedStoredProcedureQuery, createNativeQuery, createNativeQuery, createNativeQuery, createQuery, createQuery, createQuery, createQuery, createQuery, createStoredProcedureQuery, createStoredProcedureQuery, createStoredProcedureQuery, detach, find, find, find, find, flush, getCriteriaBuilder, getDelegate, getEntityGraph, getEntityGraphs, getEntityManagerFactory, getFlushMode, getLockMode, getMetamodel, getProperties, getReference, getTransaction, isJoinedToTransaction, isOpen, joinTransaction, lock, lock, merge, persist, refresh, refresh, refresh, refresh, remove, setFlushMode, setProperty, unwrap`

- - ### Method Detail

    - #### createFullTextQuery

          FullTextQuery createFullTextQuery(Query luceneQuery,
                                            Class<?>... entities)

      Create a fulltext query on top of a native Lucene query returning the matching objects of type `entities` and their respective subclasses.
      Parameters:
        `luceneQuery` - The native Lucene query to be rn against the Lucene index.
        `entities` - List of classes for type filtering. The query result will only return entities of the specified types and their respective subtype. If no class is specified no type filtering will take place.
      Returns:
        A `FullTextQuery` wrapping around the native Lucene wuery.
      Throws:
        `IllegalArgumentException` - if entityType is `null` or not a class or superclass annotated with `@Indexed`.

    - #### createFullTextQuery

          FullTextQuery createFullTextQuery(QueryDescriptor descriptor,
                                            Class<?>... entities)

      Creates a fulltext query from the given query descriptor.
      Parameters:
        `descriptor` - The query descriptor
        `entities` - List of classes for type filtering. The query result will only return entities of the specified types and their respective subtype. If no class is specified no type filtering will take place.
      Returns:
        A `FullTextQuery` using the given query descriptor.
      Throws:
        `IllegalArgumentException` - if entityType is `null` or not a class or superclass annotated with `@Indexed`.

    - #### index

          <T> void index(T entity)

      Force the (re)indexing of a given managed object. Indexation is batched per transaction: if a transaction is active, the operation will not affect the index at least until commit.

      Any `EntityIndexingInterceptor` registered on the entity will be ignored: this method forces an index operation.

      Type Parameters:
        `T` - the type of the entity to index
      Parameters:
        `entity` - The entity to index - must not be `null`.
      Throws:
        `IllegalArgumentException` - if entity is null or not an @Indexed entity

    - #### getSearchFactory

          SearchFactory getSearchFactory()

      Returns:
        the `SearchFactory` instance.

    - #### purge

          <T> void purge(Class<T> entityType,
                         Serializable id)

      Remove the entity with the type `entityType` and the identifier `id` from the index. If `id == null` all indexed entities of this type and its indexed subclasses are deleted. In this case this method behaves like `purgeAll(Class)`.

      Any `EntityIndexingInterceptor` registered on the entity will be ignored: this method forces a purge operation.

      Type Parameters:
        `T` - the type of the entity to purge
      Parameters:
        `entityType` - The type of the entity to delete.
        `id` - The id of the entity to delete.
      Throws:
        `IllegalArgumentException` - if entityType is `null` or not a class or superclass annotated with `@Indexed`.

    - #### purgeAll

          <T> void purgeAll(Class<T> entityType)

      Remove all entities from of particular class and all its subclasses from the index.

      Any `EntityIndexingInterceptor` registered on the entity type will be ignored.

      Type Parameters:
        `T` - the type of the entity to purge
      Parameters:
        `entityType` - The class of the entities to remove.
      Throws:
        `IllegalArgumentException` - if entityType is `null` or not a class or superclass annotated with `@Indexed`.

    - #### flushToIndexes

          void flushToIndexes()

      Flush all index changes forcing Hibernate Search to apply all changes to the index not waiting for the batch limit.

    - #### createIndexer

          MassIndexer createIndexer(Class<?>... types)

      Creates a MassIndexer to rebuild the indexes of some or all indexed entity types. Instances cannot be reused.

      Any `EntityIndexingInterceptor` registered on the entity types are applied: each instance will trigger an `EntityIndexingInterceptor.onAdd(Object)` event from where you can customize the indexing operation.

      Parameters:
        `types` - optionally restrict the operation to selected types
      Returns:
        a new MassIndexer

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved