fr.gouv.culture.sdx.search.lucene.analysis
Class MetaAnalyzer

java.lang.Object
  extended by org.apache.lucene.analysis.Analyzer
      extended by fr.gouv.culture.sdx.search.lucene.analysis.AbstractAnalyzer
          extended by fr.gouv.culture.sdx.search.lucene.analysis.MetaAnalyzer
All Implemented Interfaces:
Analyzer, java.io.Serializable, org.apache.avalon.framework.configuration.Configurable, org.apache.avalon.framework.logger.LogEnabled, org.apache.excalibur.xml.sax.XMLizable

public class MetaAnalyzer
extends AbstractAnalyzer

A dispatcher for field specific analyzers.

This analyzer knows about specific analyzers for the fields of a document base. Hence, when its tokenStream(fieldName, reader) method is called, it attempts to dispatch the task to a specific analyzer for the given field name.

See Also:
Serialized Form

Field Summary
protected static java.lang.String ANALYZER_TYPE
           
 
Fields inherited from class fr.gouv.culture.sdx.search.lucene.analysis.AbstractAnalyzer
logger
 
Constructor Summary
MetaAnalyzer()
          Creates a MetaAnalyzer A super.getLog() must be set and then this MetaAnalyzer must be setUp.
 
Method Summary
protected  java.lang.String getAnalyzerType()
           
 FieldList getFieldList()
          Returns a the FieldList for this MetaAnalyzer (basically a Hashtable of all the Fields)
 void setUp(FieldList fields)
          Builds an analyzer with definitions for fields.
 org.apache.lucene.analysis.TokenStream tokenStream(java.io.Reader reader)
          Deprecated. use tokenStream(String, Reader) instead.
 org.apache.lucene.analysis.TokenStream tokenStream(java.lang.String fieldName, java.io.Reader reader)
          Tokenizes contents.
 
Methods inherited from class fr.gouv.culture.sdx.search.lucene.analysis.AbstractAnalyzer
configure, enableLogging, toSAX
 
Methods inherited from class org.apache.lucene.analysis.Analyzer
getPositionIncrementGap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANALYZER_TYPE

protected static final java.lang.String ANALYZER_TYPE
See Also:
Constant Field Values
Constructor Detail

MetaAnalyzer

public MetaAnalyzer()
Creates a MetaAnalyzer

A super.getLog() must be set and then this MetaAnalyzer must be setUp.

See Also:
setUp(fr.gouv.culture.sdx.search.lucene.FieldList)
Method Detail

getAnalyzerType

protected java.lang.String getAnalyzerType()
Specified by:
getAnalyzerType in class AbstractAnalyzer

setUp

public void setUp(FieldList fields)
           throws SDXException
Builds an analyzer with definitions for fields.

Parameters:
fields - The fields and their definitions (cannot be null).
Throws:
SDXException

tokenStream

public org.apache.lucene.analysis.TokenStream tokenStream(java.lang.String fieldName,
                                                          java.io.Reader reader)
Tokenizes contents.

The tokenizing is never done by this object. Instead, using the provided field name, it will try to get a specific analyzer from the fields definition. If it can't find one, it will use the default analyzer.

Specified by:
tokenStream in interface Analyzer
Specified by:
tokenStream in class org.apache.lucene.analysis.Analyzer
Parameters:
fieldName - The field name for tokenization
reader - The reader

getFieldList

public FieldList getFieldList()
Returns a the FieldList for this MetaAnalyzer (basically a Hashtable of all the Fields)

Returns:
FieldList

tokenStream

public org.apache.lucene.analysis.TokenStream tokenStream(java.io.Reader reader)
Deprecated. use tokenStream(String, Reader) instead.

Creates a TokenStream which tokenizes all the text in the provided Reader. Provided for backward compatibility only.

See Also:
Analyzer.tokenStream(java.io.Reader)


Copyright © 2000-2010 Ministere de la culture et de la communication / AJLSM. All Rights Reserved.