Class TokenStreamOffsetStrategy
- java.lang.Object
-
- org.apache.lucene.search.uhighlight.FieldOffsetStrategy
-
- org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy
-
- org.apache.lucene.search.uhighlight.TokenStreamOffsetStrategy
-
public class TokenStreamOffsetStrategy extends AnalysisOffsetStrategy
Analyzes the text, producing a singleOffsetsEnum
wrapping theTokenStream
filtered to terms in the query, including wildcards. It can't handle position-sensitive queries (phrases). Passage accuracy suffers because the freq() is unknown -- it's alwaysInteger.MAX_VALUE
instead.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
TokenStreamOffsetStrategy.TokenStreamOffsetsEnum
-
Field Summary
Fields Modifier and Type Field Description private CharArrayMatcher[]
combinedAutomata
-
Fields inherited from class org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy
analyzer
-
Fields inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy
components
-
-
Constructor Summary
Constructors Constructor Description TokenStreamOffsetStrategy(UHComponents components, Analyzer indexAnalyzer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static CharArrayMatcher[]
convertTermsToMatchers(BytesRef[] terms, CharArrayMatcher[] matchers)
OffsetsEnum
getOffsetsEnum(LeafReader reader, int docId, java.lang.String content)
The primary method -- return offsets for highlightable words in the specified document.-
Methods inherited from class org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy
getOffsetSource, tokenStream
-
Methods inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy
createOffsetsEnumFromReader, createOffsetsEnumsForAutomata, createOffsetsEnumsForTerms, createOffsetsEnumsWeightMatcher, getField
-
-
-
-
Field Detail
-
combinedAutomata
private final CharArrayMatcher[] combinedAutomata
-
-
Constructor Detail
-
TokenStreamOffsetStrategy
public TokenStreamOffsetStrategy(UHComponents components, Analyzer indexAnalyzer)
-
-
Method Detail
-
convertTermsToMatchers
private static CharArrayMatcher[] convertTermsToMatchers(BytesRef[] terms, CharArrayMatcher[] matchers)
-
getOffsetsEnum
public OffsetsEnum getOffsetsEnum(LeafReader reader, int docId, java.lang.String content) throws java.io.IOException
Description copied from class:FieldOffsetStrategy
The primary method -- return offsets for highlightable words in the specified document.Callers are expected to close the returned OffsetsEnum when it has been finished with
- Specified by:
getOffsetsEnum
in classFieldOffsetStrategy
- Throws:
java.io.IOException
-
-