org.hibernate.search.indexes.spi

## Interface IndexManager

- All Known Implementing Classes:
    DirectoryBasedIndexManager, ElasticsearchIndexManager, NRTIndexManager

      public interface IndexManager

  An IndexManager abstracts the specific configuration and implementations being used on a single index. For each index a different implementation can be used, or different configurations. While in previous versions of Hibernate Search the backend could be sync or async, this fact is now considered a detail of the concrete IndexManager implementations. This makes it possible to configure each index manager (and hence index) differently. A concrete implementation can also decide to only support a specific mode of operation. It can ignore some configuration properties or expect additional properties.
  Author:
    Sanne Grinovero (C) 2011 Red Hat Inc.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addContainedEntity(IndexedTypeIdentifier entityType)`
    `void` | `awaitAsyncProcessingCompletion()` Blocks until all the previously submitted work via `performStreamOperation(LuceneWork, IndexingMonitor, boolean)` are applied to the index.
    `void` | `destroy()` Called when a `SearchFactory` is stopped.
    `void` | `flushAndReleaseResources()` Flushes any pending write operations and closes underlying resources, for example release the index locks if this implementation uses a Lucene IndexWriter.
    `Analyzer` | `getAnalyzer(String name)`
    `IndexedTypeSet` | `getContainedTypes()`
    `IndexManagerType` | `getIndexManagerType()`
    `String` | `getIndexName()` Useful for labeling and logging resources from this instance.
    `ReaderProvider` | `getReaderProvider()` Provide access to `IndexReader`s.
    `LuceneWorkSerializer` | `getSerializer()` Deprecated. This method is scheduled for removal. It is not invoked by Hibernate Search any more, implementations may make this a no-op and safely return null.
    `Similarity` | `getSimilarity()`
    `void` | `initialize(String indexName, Properties properties, Similarity similarity, WorkerBuildContext context)` Initialize this `IndexManager` before its use.
    `void` | `optimize()` To optimize the underlying index.
    `void` | `performOperations(List<LuceneWork> queue, IndexingMonitor monitor)` Used to apply update operations to the index.
    `void` | `performStreamOperation(LuceneWork singleOperation, IndexingMonitor monitor, boolean forceAsync)` Perform a single non-transactional operation, best to stream large amounts of operations.
    `void` | `setSearchFactory(ExtendedSearchIntegrator boundSearchIntegrator)` Connects this `IndexManager` to a new `ExtendedSearchIntegrator`.

- - ### Method Detail

    - #### getIndexName

          String getIndexName()

      Useful for labeling and logging resources from this instance.
      Returns:
        the name of the index maintained by this manager.

    - #### getReaderProvider

          ReaderProvider getReaderProvider()

      Provide access to `IndexReader`s.
      Returns:
        a `ReaderProvider` instance for the index managed by this instance

    - #### performOperations

          void performOperations(List<LuceneWork> queue,
                                 IndexingMonitor monitor)

      Used to apply update operations to the index. Operations can be applied in sync or async, depending on the IndexManager implementation and configuration.
      Parameters:
        `monitor` - no be notified of indexing events
        `queue` - the list of write operations to apply.

    - #### performStreamOperation

          void performStreamOperation(LuceneWork singleOperation,
                                      IndexingMonitor monitor,
                                      boolean forceAsync)

      Perform a single non-transactional operation, best to stream large amounts of operations. Operations might be applied out-of-order! To mark two series of operations which need to be applied in order, use a transactional operation between them: a transactional operation will always flush all streaming operations first, and be applied before subsequent streaming operations.
      Parameters:
        `singleOperation` - the operation to perform
        `monitor` - no be notified of indexing events
        `forceAsync` - if true, the invocation will not block to wait for it being applied. When false this will depend on the backend configuration.

    - #### awaitAsyncProcessingCompletion

          void awaitAsyncProcessingCompletion()

      Blocks until all the previously submitted work via `performStreamOperation(LuceneWork, IndexingMonitor, boolean)` are applied to the index.

    - #### initialize

          void initialize(String indexName,
                          Properties properties,
                          Similarity similarity,
                          WorkerBuildContext context)

      Initialize this `IndexManager` before its use.
      Parameters:
        `indexName` - the unique name of the index (manager). Can be used to retrieve a `IndexManager` instance via the search factory and `IndexManagerHolder`.
        `properties` - the configuration properties
        `similarity` - defines the component of Lucene scoring
        `context` - context information needed to initialize this index manager

    - #### destroy

          void destroy()

      Called when a `SearchFactory` is stopped. This method typically releases resources.

    - #### getContainedTypes

          IndexedTypeSet getContainedTypes()

      Returns:
        the set of classes being indexed in this manager

    - #### getSimilarity

          Similarity getSimilarity()

      Returns:
        the `Similarity` applied to this index. Note, only a single `Similarity` can be applied to a given index.

    - #### getAnalyzer

          Analyzer getAnalyzer(String name)

      Parameters:
        `name` - the name of the analyzer to retrieve.
      Returns:
        Returns the `Analyzer` with the given name (see also `AnalyzerDef`)
      Throws:
        `SearchException` - in case the analyzer name is unknown.

    - #### setSearchFactory

          void setSearchFactory(ExtendedSearchIntegrator boundSearchIntegrator)

      Connects this `IndexManager` to a new `ExtendedSearchIntegrator`.
      Parameters:
        `boundSearchIntegrator` - the existing search factory to which to associate this index manager with

    - #### addContainedEntity

          void addContainedEntity(IndexedTypeIdentifier entityType)

      Parameters:
        `entityType` - Adds the specified entity type to this index manager, making it responsible for manging this type.

    - #### optimize

          void optimize()

      To optimize the underlying index. Some implementations might ignore the request, if it doesn't apply to them.

    - #### getSerializer

          @Deprecated
          LuceneWorkSerializer getSerializer()

      Deprecated. This method is scheduled for removal. It is not invoked by Hibernate Search any more, implementations may make this a no-op and safely return null.

    - #### flushAndReleaseResources

          void flushAndReleaseResources()

      Flushes any pending write operations and closes underlying resources, for example release the index locks if this implementation uses a Lucene IndexWriter.

    - #### getIndexManagerType

          IndexManagerType getIndexManagerType()

      Returns:
        the `IndexManagerType` of this implementation.

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