org.compass.core.lucene.engine.optimizer
Class AdaptiveOptimizer

java.lang.Object
  extended by org.compass.core.lucene.engine.optimizer.AbstractOptimizer
      extended by org.compass.core.lucene.engine.optimizer.AdaptiveOptimizer
All Implemented Interfaces:
CompassConfigurable, SearchEngineOptimizer, LuceneSearchEngineOptimizer

public class AdaptiveOptimizer
extends AbstractOptimizer
implements CompassConfigurable

The Adaptive optimizer uses the configured LuceneEnvironment.Optimizer.Adaptive.MERGE_FACTOR (which defaults to 10). Basically, ends up calling Lucene IndexWriter.optimize(int) with the provided merge factor which optimizes the index up to the given merge factor.

Forced optimization ends up optimizing the sub index up to a single segmend, overriding the merge factor (just for that call, with a merge factor of 1).

Author:
kimchy

Field Summary
 
Fields inherited from class org.compass.core.lucene.engine.optimizer.AbstractOptimizer
log
 
Constructor Summary
AdaptiveOptimizer()
           
 
Method Summary
 boolean canBeScheduled()
          Can the optimizer be scheduled or not.
 void configure(CompassSettings settings)
          Configure using the given settings.
protected  void doForceOptimize(String subIndex)
           
protected  void doOptimize(String subIndex)
           
protected  void doOptimize(String subIndex, int mergeFactor)
           
protected  boolean isOptimizeOnlyIfIndexChanged()
           
 
Methods inherited from class org.compass.core.lucene.engine.optimizer.AbstractOptimizer
doStart, doStop, forceOptimize, forceOptimize, getSearchEngineFactory, isRunning, optimize, optimize, setSearchEngineFactory, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdaptiveOptimizer

public AdaptiveOptimizer()
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Description copied from interface: CompassConfigurable
Configure using the given settings.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings for the configured object
Throws:
CompassException

canBeScheduled

public boolean canBeScheduled()
Description copied from interface: LuceneSearchEngineOptimizer
Can the optimizer be scheduled or not.

Specified by:
canBeScheduled in interface LuceneSearchEngineOptimizer

isOptimizeOnlyIfIndexChanged

protected boolean isOptimizeOnlyIfIndexChanged()

doForceOptimize

protected void doForceOptimize(String subIndex)
                        throws SearchEngineException
Specified by:
doForceOptimize in class AbstractOptimizer
Throws:
SearchEngineException

doOptimize

protected void doOptimize(String subIndex)
                   throws SearchEngineException
Specified by:
doOptimize in class AbstractOptimizer
Throws:
SearchEngineException

doOptimize

protected void doOptimize(String subIndex,
                          int mergeFactor)
                   throws SearchEngineException
Throws:
SearchEngineException


Copyright (c) 2004-2008 The Compass Project.