org.hibernate.search.store.optimization

## Interface OptimizerStrategy

- All Known Implementing Classes:
    ExplicitOnlyOptimizerStrategy, IncrementalOptimizerStrategy

      public interface OptimizerStrategy

  Controls how and when the indexes are optimized. Note: Implementations need to be threadsafe.
  Author:
    Emmanuel Bernard, Sanne Grinovero

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOperationWithinTransactionCount(long increment)` To count the amount of operations which where applied to the index.
    `void` | `initialize(IndexManager indexManager, Properties indexProperties)` Initializes the `OptimizerStrategy`.
    `void` | `optimize(Workspace workspace)` Allows the implementation to start an optimization process.
    `boolean` | `performOptimization(IndexWriter writer)` Invokes optimize on the IndexWriter; This is invoked when an optimization has been explicitly requested by the user API using `SearchIntegrator.optimize()` or `SearchIntegrator.optimize(org.hibernate.search.spi.IndexedTypeIdentifier)`, or at the start or end of a MassIndexer's work.

- - ### Method Detail

    - #### performOptimization

          boolean performOptimization(IndexWriter writer)

      Invokes optimize on the IndexWriter; This is invoked when an optimization has been explicitly requested by the user API using `SearchIntegrator.optimize()` or `SearchIntegrator.optimize(org.hibernate.search.spi.IndexedTypeIdentifier)`, or at the start or end of a MassIndexer's work.
      Parameters:
        `writer` - the index writer
      Returns:
        `true` if optimisation occurred, `false` otherwise
      Throws:
        `SearchException` - in case of IO errors on the index

    - #### addOperationWithinTransactionCount

          void addOperationWithinTransactionCount(long increment)

      To count the amount of operations which where applied to the index. Invoked once per transaction.
      Parameters:
        `increment` - operation count

    - #### optimize

          void optimize(Workspace workspace)

      Allows the implementation to start an optimization process. The decision of optimizing or not is up to the implementor. This is invoked after all changes of a transaction are applied, but never during stream operation such as those used by the MassIndexer.
      Parameters:
        `workspace` - the current work space

    - #### initialize

          void initialize(IndexManager indexManager,
                          Properties indexProperties)

      Initializes the `OptimizerStrategy`. Is called once at the initialisation of the strategy.
      Parameters:
        `indexManager` - the index manager for which this strategy applies
        `indexProperties` - the configuration properties

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