org.apache.lucene.analysis
Class PerFieldAnalyzerWrapper
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.PerFieldAnalyzerWrapper
- public class PerFieldAnalyzerWrapper
- extends Analyzer
This analyzer is used to facilitate scenarios where different
fields require different analysis techniques. Use addAnalyzer(java.lang.String, org.apache.lucene.analysis.Analyzer)
to add a non-default analyzer on a field name basis.
See TestPerFieldAnalzyerWrapper
for example usage.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PerFieldAnalyzerWrapper
public PerFieldAnalyzerWrapper(Analyzer defaultAnalyzer)
- Constructs with default analyzer.
- Parameters:
defaultAnalyzer
- Any fields not specifically
defined to use a different analyzer will use the one provided here.
addAnalyzer
public void addAnalyzer(String fieldName,
Analyzer analyzer)
- Defines an analyzer to use for the specified field.
- Parameters:
fieldName
- field name requiring a non-default analyzer.analyzer
- non-default analyzer to use for field
tokenStream
public TokenStream tokenStream(String fieldName,
Reader reader)
- Description copied from class:
Analyzer
- Creates a TokenStream which tokenizes all the text in the provided
Reader. Default implementation forwards to tokenStream(Reader) for
compatibility with older version. Override to allow Analyzer to choose
strategy based on document and/or field. Must be able to handle null
field name for backward compatibility.
- Overrides:
tokenStream
in class Analyzer
Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.