org.apache.cocoon.components.search.analyzer
Class ConfigurableAnalyzer

java.lang.Object
  extended by org.apache.lucene.analysis.Analyzer
      extended by org.apache.cocoon.components.search.analyzer.ConfigurableAnalyzer
All Implemented Interfaces:
org.apache.avalon.framework.logger.LogEnabled
Direct Known Subclasses:
ConfigurablePerFieldAnalyzer, ConfigurableStopwordAnalyzer

public abstract class ConfigurableAnalyzer
extends org.apache.lucene.analysis.Analyzer
implements org.apache.avalon.framework.logger.LogEnabled

Analyzer Wrapper to allow to configure a lucene analyzer with a XML file

Author:
Nicolas Maisonneuve

Field Summary
protected  org.apache.lucene.analysis.Analyzer analyzer
          the lucene analyzer
protected  AnalyzerManager analyzerM
          the analyzer manager component
protected  org.apache.avalon.framework.logger.Logger logger
          a logger
 
Constructor Summary
ConfigurableAnalyzer()
           
 
Method Summary
protected abstract  void configure(org.apache.avalon.framework.configuration.Configuration configuration)
          Configure this analyzer. this method is called in
 boolean enableCheckFile()
          is the checkFile property enable ?
 void enableLogging(org.apache.avalon.framework.logger.Logger log)
           
 boolean reconfigure()
          reconfigure the analyzer if the config file has changed
 void setAnalyerManager(AnalyzerManager analyzerM)
          set the analyzerManager
 void setConfigFile(org.apache.excalibur.source.Source source)
          Set the configuration file
 void setEnableCheckFile(boolean check)
          Enable the check of the config file (to update the analyzer if the config file changes) when the method
 org.apache.lucene.analysis.TokenStream tokenStream(java.lang.String fieldName, java.io.Reader reader)
           
 
Methods inherited from class org.apache.lucene.analysis.Analyzer
tokenStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

analyzer

protected org.apache.lucene.analysis.Analyzer analyzer
the lucene analyzer


logger

protected org.apache.avalon.framework.logger.Logger logger
a logger


analyzerM

protected AnalyzerManager analyzerM
the analyzer manager component

Constructor Detail

ConfigurableAnalyzer

public ConfigurableAnalyzer()
Method Detail

configure

protected abstract void configure(org.apache.avalon.framework.configuration.Configuration configuration)
                           throws org.apache.avalon.framework.configuration.ConfigurationException
Configure this analyzer. this method is called in

Throws:
org.apache.avalon.framework.configuration.ConfigurationException
See Also:
method

tokenStream

public final org.apache.lucene.analysis.TokenStream tokenStream(java.lang.String fieldName,
                                                                java.io.Reader reader)
Overrides:
tokenStream in class org.apache.lucene.analysis.Analyzer

enableLogging

public void enableLogging(org.apache.avalon.framework.logger.Logger log)
Specified by:
enableLogging in interface org.apache.avalon.framework.logger.LogEnabled

setEnableCheckFile

public void setEnableCheckFile(boolean check)
Enable the check of the config file (to update the analyzer if the config file changes) when the method

Parameters:
check - true if we want that
See Also:
is called

enableCheckFile

public boolean enableCheckFile()
is the checkFile property enable ?


reconfigure

public boolean reconfigure()
                    throws org.apache.avalon.framework.configuration.ConfigurationException
reconfigure the analyzer if the config file has changed

Returns:
boolean true if the analyzer is reconfigured (=file has changed) else false
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

setConfigFile

public void setConfigFile(org.apache.excalibur.source.Source source)
                   throws org.apache.avalon.framework.configuration.ConfigurationException
Set the configuration file

Parameters:
source - Source configuration file
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

setAnalyerManager

public void setAnalyerManager(AnalyzerManager analyzerM)
set the analyzerManager

Parameters:
analyzerM - AnalyzerManager


Copyright © $ Apache Software Foundation. All Rights Reserved.