org.hibernate.search.store.optimization.impl

## Class IncrementalOptimizerStrategy

- java.lang.Object
- - org.hibernate.search.store.optimization.impl.ExplicitOnlyOptimizerStrategy
  - - org.hibernate.search.store.optimization.impl.IncrementalOptimizerStrategy

- All Implemented Interfaces:
    OptimizerStrategy

      public class IncrementalOptimizerStrategy
      extends ExplicitOnlyOptimizerStrategy
      implements OptimizerStrategy

  Optimization strategy triggered after a certain amount of operations
  Author:
    Emmanuel Bernard

- - ### Field Summary

    - ### Fields inherited from class org.hibernate.search.store.optimization.impl.ExplicitOnlyOptimizerStrategy

      `indexName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `IncrementalOptimizerStrategy()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addOperationWithinTransactionCount(long operations)` To count the amount of operations which where applied to the index.
    `long` | `getOptimizationsPerformed()`
    `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.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IncrementalOptimizerStrategy

          public IncrementalOptimizerStrategy()

  - ### Method Detail

    - #### performOptimization

          public boolean performOptimization(IndexWriter writer)

      Description copied from interface: `OptimizerStrategy`
      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.
      Specified by:
        `performOptimization` in interface `OptimizerStrategy`
      Overrides:
        `performOptimization` in class `ExplicitOnlyOptimizerStrategy`
      Parameters:
        `writer` - the index writer
      Returns:
        `true` if optimisation occurred, `false` otherwise

    - #### addOperationWithinTransactionCount

          public void addOperationWithinTransactionCount(long operations)

      Description copied from interface: `OptimizerStrategy`
      To count the amount of operations which where applied to the index. Invoked once per transaction.
      Specified by:
        `addOperationWithinTransactionCount` in interface `OptimizerStrategy`
      Overrides:
        `addOperationWithinTransactionCount` in class `ExplicitOnlyOptimizerStrategy`
      Parameters:
        `operations` - operation count

    - #### optimize

          public void optimize(Workspace workspace)

      Description copied from interface: `OptimizerStrategy`
      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.
      Specified by:
        `optimize` in interface `OptimizerStrategy`
      Overrides:
        `optimize` in class `ExplicitOnlyOptimizerStrategy`
      Parameters:
        `workspace` - the current work space

    - #### initialize

          public void initialize(IndexManager indexManager,
                                 Properties indexProperties)

      Description copied from interface: `OptimizerStrategy`
      Initializes the `OptimizerStrategy`. Is called once at the initialisation of the strategy.
      Specified by:
        `initialize` in interface `OptimizerStrategy`
      Overrides:
        `initialize` in class `ExplicitOnlyOptimizerStrategy`
      Parameters:
        `indexManager` - the index manager for which this strategy applies
        `indexProperties` - the configuration properties

    - #### getOptimizationsPerformed

          public long getOptimizationsPerformed()

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