Class LimitTokenOffsetAnalyzer
java.lang.Object
org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.AnalyzerWrapper
org.elasticsearch.search.fetch.subphase.highlight.LimitTokenOffsetAnalyzer
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public final class LimitTokenOffsetAnalyzer
extends org.apache.lucene.analysis.AnalyzerWrapper
This analyzer limits the highlighting once it sees a token with a start offset <= the configured limit,
which won't pass and will end the stream.
- See Also:
LimitTokenOffsetFilter
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.analysis.Analyzer
org.apache.lucene.analysis.Analyzer.ReuseStrategy, org.apache.lucene.analysis.Analyzer.TokenStreamComponents
-
Field Summary
Fields inherited from class org.apache.lucene.analysis.Analyzer
GLOBAL_REUSE_STRATEGY, PER_FIELD_REUSE_STRATEGY
-
Constructor Summary
Constructors Constructor Description LimitTokenOffsetAnalyzer(org.apache.lucene.analysis.Analyzer delegate, int maxOffset)
Build an analyzer that limits the highlighting once it sees a token with a start offset <= the configured limit, which won't pass and will end the stream. -
Method Summary
Modifier and Type Method Description protected org.apache.lucene.analysis.Analyzer
getWrappedAnalyzer(java.lang.String fieldName)
java.lang.String
toString()
protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents
wrapComponents(java.lang.String fieldName, org.apache.lucene.analysis.Analyzer.TokenStreamComponents components)
Methods inherited from class org.apache.lucene.analysis.AnalyzerWrapper
attributeFactory, createComponents, getOffsetGap, getPositionIncrementGap, initReader, initReaderForNormalization, normalize, wrapReader, wrapReaderForNormalization, wrapTokenStreamForNormalization
Methods inherited from class org.apache.lucene.analysis.Analyzer
close, getReuseStrategy, getVersion, normalize, setVersion, tokenStream, tokenStream
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
LimitTokenOffsetAnalyzer
public LimitTokenOffsetAnalyzer(org.apache.lucene.analysis.Analyzer delegate, int maxOffset)Build an analyzer that limits the highlighting once it sees a token with a start offset <= the configured limit, which won't pass and will end the stream. SeeLimitTokenOffsetFilter
for more details.- Parameters:
delegate
- the analyzer to wrapmaxOffset
- max number of tokens to produce
-
-
Method Details
-
getWrappedAnalyzer
protected org.apache.lucene.analysis.Analyzer getWrappedAnalyzer(java.lang.String fieldName)- Specified by:
getWrappedAnalyzer
in classorg.apache.lucene.analysis.AnalyzerWrapper
-
wrapComponents
protected org.apache.lucene.analysis.Analyzer.TokenStreamComponents wrapComponents(java.lang.String fieldName, org.apache.lucene.analysis.Analyzer.TokenStreamComponents components)- Overrides:
wrapComponents
in classorg.apache.lucene.analysis.AnalyzerWrapper
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-