org.apache.lucene.analysis.miscellaneous
Class LimitTokenCountAnalyzer
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.AnalyzerWrapper
org.apache.lucene.analysis.miscellaneous.LimitTokenCountAnalyzer
- All Implemented Interfaces:
- Closeable
public final class LimitTokenCountAnalyzer
- extends AnalyzerWrapper
This Analyzer limits the number of tokens while indexing. It is
a replacement for the maximum field length setting inside IndexWriter
.
- See Also:
LimitTokenCountFilter
LimitTokenCountAnalyzer
public LimitTokenCountAnalyzer(Analyzer delegate,
int maxTokenCount)
- Build an analyzer that limits the maximum number of tokens per field.
This analyzer will not consume any tokens beyond the maxTokenCount limit
- See Also:
LimitTokenCountAnalyzer(Analyzer,int,boolean)
LimitTokenCountAnalyzer
public LimitTokenCountAnalyzer(Analyzer delegate,
int maxTokenCount,
boolean consumeAllTokens)
- Build an analyzer that limits the maximum number of tokens per field.
- Parameters:
delegate
- the analyzer to wrapmaxTokenCount
- max number of tokens to produceconsumeAllTokens
- whether all tokens from the delegate should be consumed even if maxTokenCount is reached.
getWrappedAnalyzer
protected Analyzer getWrappedAnalyzer(String fieldName)
- Specified by:
getWrappedAnalyzer
in class AnalyzerWrapper
wrapComponents
protected Analyzer.TokenStreamComponents wrapComponents(String fieldName,
Analyzer.TokenStreamComponents components)
- Specified by:
wrapComponents
in class AnalyzerWrapper
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.