org.hibernate.search.store.optimization.impl
Class ExplicitOnlyOptimizerStrategy

java.lang.Object
  extended by org.hibernate.search.store.optimization.impl.ExplicitOnlyOptimizerStrategy
All Implemented Interfaces:
OptimizerStrategy
Direct Known Subclasses:
IncrementalOptimizerStrategy

public class ExplicitOnlyOptimizerStrategy
extends Object
implements OptimizerStrategy

This OptimizerStrategy will only optimize the index when forced to, using an explicit invocation to SearchFactory#optimize() or SearchFactory#optimize(Class)

Author:
Emmanuel Bernard, Sanne Grinovero

Field Summary
protected  String indexName
           
 
Constructor Summary
ExplicitOnlyOptimizerStrategy()
           
 
Method Summary
 void addOperationWithinTransactionCount(long operations)
          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 SearchFactory.optimize() or SearchFactory.optimize(Class), 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
 

Field Detail

indexName

protected String indexName
Constructor Detail

ExplicitOnlyOptimizerStrategy

public ExplicitOnlyOptimizerStrategy()
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 SearchFactory.optimize() or SearchFactory.optimize(Class), or at the start or end of a MassIndexer's work.

Specified by:
performOptimization in interface OptimizerStrategy
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
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
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
Parameters:
indexManager - the index manager for which this strategy applies
indexProperties - the configuration properties


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