public final class LimitTokenCountAnalyzer extends Analyzer
IndexWriter
.Constructor and Description |
---|
LimitTokenCountAnalyzer(Analyzer delegate,
int maxTokenCount)
Build an analyzer that limits the maximum number of tokens per field.
|
Modifier and Type | Method and Description |
---|---|
int |
getOffsetGap(Fieldable field)
Just like
Analyzer.getPositionIncrementGap(java.lang.String) , except for
Token offsets instead. |
int |
getPositionIncrementGap(String fieldName)
Invoked before indexing a Fieldable instance if
terms have already been added to that field.
|
TokenStream |
reusableTokenStream(String fieldName,
Reader reader)
Creates a TokenStream that is allowed to be re-used
from the previous time that the same thread called
this method.
|
TokenStream |
tokenStream(String fieldName,
Reader reader)
Creates a TokenStream which tokenizes all the text in the provided
Reader.
|
String |
toString() |
close, getPreviousTokenStream, setPreviousTokenStream
public LimitTokenCountAnalyzer(Analyzer delegate, int maxTokenCount)
public TokenStream tokenStream(String fieldName, Reader reader)
Analyzer
tokenStream
in class Analyzer
public TokenStream reusableTokenStream(String fieldName, Reader reader) throws IOException
Analyzer
reusableTokenStream
in class Analyzer
IOException
public int getPositionIncrementGap(String fieldName)
Analyzer
getPositionIncrementGap
in class Analyzer
fieldName
- Fieldable name being indexed.Analyzer.tokenStream(String,Reader)
public int getOffsetGap(Fieldable field)
Analyzer
Analyzer.getPositionIncrementGap(java.lang.String)
, except for
Token offsets instead. By default this returns 1 for
tokenized fields and, as if the fields were joined
with an extra space character, and 0 for un-tokenized
fields. This method is only called if the field
produced at least one token for indexing.getOffsetGap
in class Analyzer
field
- the field just indexedAnalyzer.tokenStream(String,Reader)