org.hibernate.search

## Interface SearchFactory

-     public interface SearchFactory

  Provide application wide operations as well as access to the underlying Lucene resources.
  Author:
    Emmanuel Bernard, Hardy Ferentschik, Sanne Grinovero

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `QueryContextBuilder` | `buildQueryBuilder()`
    `Analyzer` | `getAnalyzer(Class<?> clazz)` Retrieves the scoped analyzer for a given class.
    `Analyzer` | `getAnalyzer(String name)` Retrieve an analyzer instance by its definition name
    `IndexedTypeDescriptor` | `getIndexedTypeDescriptor(Class<?> entityType)` Returns a descriptor for the specified entity type describing its indexed state.
    `Set<Class<?>>` | `getIndexedTypes()` Returns the set of currently indexed types.
    `IndexReaderAccessor` | `getIndexReaderAccessor()` Provides access to the IndexReader API
    `Statistics` | `getStatistics()` Retrieve the statistics instance for this factory.
    `void` | `optimize()` Optimize all indexes
    `void` | `optimize(Class<?> entityType)` Optimize the index holding `entityType`
    `<T> T` | `unwrap(Class<T> cls)` Unwraps some internal Hibernate Search types.

- - ### Method Detail

    - #### optimize

          void optimize()

      Optimize all indexes

    - #### optimize

          void optimize(Class<?> entityType)

      Optimize the index holding `entityType`
      Parameters:
        `entityType` - the entity type (index) to optimize

    - #### getAnalyzer

          Analyzer getAnalyzer(String name)

      Retrieve an analyzer instance by its definition name
      Parameters:
        `name` - the name of the analyzer
      Returns:
        analyzer with the specified name
      Throws:
        `SearchException` - if the definition name is unknown

    - #### getAnalyzer

          Analyzer getAnalyzer(Class<?> clazz)

      Retrieves the scoped analyzer for a given class.
      Parameters:
        `clazz` - The class for which to retrieve the analyzer.
      Returns:
        The scoped analyzer for the specified class.
      Throws:
        `IllegalArgumentException` - in case `clazz == null` or the specified class is not an indexed entity.

    - #### buildQueryBuilder

          QueryContextBuilder buildQueryBuilder()

      Returns:
        return a query builder providing a fluent API to create Lucene queries

    - #### getStatistics

          Statistics getStatistics()

      Retrieve the statistics instance for this factory.
      Returns:
        The statistics.

    - #### getIndexReaderAccessor

          IndexReaderAccessor getIndexReaderAccessor()

      Provides access to the IndexReader API
      Returns:
        the IndexReaderAccessor for this SearchFactory

    - #### getIndexedTypeDescriptor

          IndexedTypeDescriptor getIndexedTypeDescriptor(Class<?> entityType)

      Returns a descriptor for the specified entity type describing its indexed state.
      Parameters:
        `entityType` - the entity for which to retrieve the descriptor
      Returns:
        a non `null` `IndexedEntityDescriptor`. This method can also be called for non indexed types. To determine whether the entity is actually indexed `IndexedTypeDescriptor.isIndexed()` can be used.
      Throws:
        `IllegalArgumentException` - in case `entityType` is `null`

    - #### getIndexedTypes

          Set<Class<?>> getIndexedTypes()

      Returns the set of currently indexed types.
      Returns:
        the set of currently indexed types. If no types are indexed the empty set is returned.

    - #### unwrap

          <T> T unwrap(Class<T> cls)

      Unwraps some internal Hibernate Search types. Currently, no public type is accessible. This method should not be used by users.
      Type Parameters:
        `T` - the type of the unwrapped class
      Parameters:
        `cls` - the type to unwrap
      Returns:
        the unwrapped object

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