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

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

public class LuceneSearchEngineOptimizerManager
extends Object
implements CompassConfigurable, SearchEngineOptimizer

A SearchEngineOptimizer manager that manages the actual SearchEngineOptimizer.

When configured (configure(org.compass.core.config.CompassSettings), creates the optimizer that will be used based on the LuceneEnvironment.Optimizer.TYPE. The default optimizer used is the AdaptiveOptimizer.

When started, will check the LuceneEnvironment.Optimizer.SCHEDULE flag, and if set to true (the default) will schedule a periodic optimization process. The period is taken from the LuceneEnvironment.Optimizer.SCHEDULE_PERIOD setting, which is set in seconds and defaults to 10.

Author:
kimchy

Constructor Summary
LuceneSearchEngineOptimizerManager(LuceneSearchEngineFactory searchEngineFactory)
           
 
Method Summary
 void configure(CompassSettings settings)
          Configure using the given settings.
 void forceOptimize()
          Optimzies the search engine regardless if it required optimization or not.
 void forceOptimize(String subIndex)
          Optimzies the sub index regardless if it required optimization or not.
 SearchEngineOptimizer getOptimizer()
           
 boolean isRunning()
          Returns true if the optimizer is running.
 void optimize()
          Optimizes the search engine index if it requires optimization.
 void optimize(String subIndex)
          Optimizes the sub index if it requires optimization.
 void start()
          Starts the given optimizer.
 void stop()
          Stops the given optimizer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LuceneSearchEngineOptimizerManager

public LuceneSearchEngineOptimizerManager(LuceneSearchEngineFactory searchEngineFactory)
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

start

public void start()
           throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Starts the given optimizer. Will start a scheduled optimizer if configured.

Specified by:
start in interface SearchEngineOptimizer
Throws:
SearchEngineException

stop

public void stop()
          throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Stops the given optimizer. Will stop the scheduled optimizer if configured.

Note that if the optimizer is stopped while optimizing, it might take some time till the optimizer will actually stop.

Specified by:
stop in interface SearchEngineOptimizer
Throws:
SearchEngineException

isRunning

public boolean isRunning()
Description copied from interface: SearchEngineOptimizer
Returns true if the optimizer is running.

Specified by:
isRunning in interface SearchEngineOptimizer

optimize

public void optimize()
              throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Optimizes the search engine index if it requires optimization.

Specified by:
optimize in interface SearchEngineOptimizer
Throws:
SearchEngineException

optimize

public void optimize(String subIndex)
              throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Optimizes the sub index if it requires optimization.

Specified by:
optimize in interface SearchEngineOptimizer
Parameters:
subIndex - The sub index to optimize
Throws:
SearchEngineException

forceOptimize

public void forceOptimize()
                   throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Optimzies the search engine regardless if it required optimization or not.

Specified by:
forceOptimize in interface SearchEngineOptimizer
Throws:
SearchEngineException

forceOptimize

public void forceOptimize(String subIndex)
                   throws SearchEngineException
Description copied from interface: SearchEngineOptimizer
Optimzies the sub index regardless if it required optimization or not.

Specified by:
forceOptimize in interface SearchEngineOptimizer
Parameters:
subIndex - The sub index to optimize
Throws:
SearchEngineException

getOptimizer

public SearchEngineOptimizer getOptimizer()


Copyright (c) 2004-2008 The Compass Project.