Class MemoryIndexOffsetStrategy
- java.lang.Object
-
- org.apache.lucene.search.uhighlight.FieldOffsetStrategy
-
- org.apache.lucene.search.uhighlight.AnalysisOffsetStrategy
-
- org.apache.lucene.search.uhighlight.MemoryIndexOffsetStrategy
-
public class MemoryIndexOffsetStrategy extends AnalysisOffsetStrategy
Uses anAnalyzeron content to get offsets and then populates aMemoryIndex.
-
-
Field Summary
Fields Modifier and Type Field Description private LeafReadermemIndexLeafReaderprivate MemoryIndexmemoryIndexprivate CharArrayMatcherpreMemIndexFilterAutomaton-
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 MemoryIndexOffsetStrategy(UHComponents components, Analyzer analyzer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static CharArrayMatcherbuildCombinedAutomaton(UHComponents components)Build oneCharArrayMatchermatching any term the query might match.OffsetsEnumgetOffsetsEnum(LeafReader reader, int docId, java.lang.String content)The primary method -- return offsets for highlightable words in the specified document.private static FilteringTokenFilternewKeepWordFilter(TokenStream tokenStream, CharArrayMatcher matcher)-
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
-
memoryIndex
private final MemoryIndex memoryIndex
-
memIndexLeafReader
private final LeafReader memIndexLeafReader
-
preMemIndexFilterAutomaton
private final CharArrayMatcher preMemIndexFilterAutomaton
-
-
Constructor Detail
-
MemoryIndexOffsetStrategy
public MemoryIndexOffsetStrategy(UHComponents components, Analyzer analyzer)
-
-
Method Detail
-
buildCombinedAutomaton
private static CharArrayMatcher buildCombinedAutomaton(UHComponents components)
Build oneCharArrayMatchermatching any term the query might match.
-
getOffsetsEnum
public OffsetsEnum getOffsetsEnum(LeafReader reader, int docId, java.lang.String content) throws java.io.IOException
Description copied from class:FieldOffsetStrategyThe 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:
getOffsetsEnumin classFieldOffsetStrategy- Throws:
java.io.IOException
-
newKeepWordFilter
private static FilteringTokenFilter newKeepWordFilter(TokenStream tokenStream, CharArrayMatcher matcher)
-
-