Class OffsetsFromPositions
- java.lang.Object
-
- org.apache.lucene.search.matchhighlight.OffsetsFromPositions
-
- All Implemented Interfaces:
OffsetsRetrievalStrategy
public final class OffsetsFromPositions extends java.lang.Object implements OffsetsRetrievalStrategy
This strategy applies to fields with stored positions but no offsets. We re-analyze the field's value to find out offsets of match positions.Note that this may fail if index data (positions stored in the index) is out of sync with the field values or the analyzer. This strategy assumes it'll never happen.
-
-
Constructor Summary
Constructors Constructor Description OffsetsFromPositions(java.lang.String field, Analyzer analyzer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) java.util.List<OffsetRange>
convertPositionsToOffsets(java.util.ArrayList<OffsetRange> positionRanges, java.util.List<java.lang.CharSequence> values)
java.util.List<OffsetRange>
get(MatchesIterator matchesIterator, MatchRegionRetriever.FieldValueProvider doc)
Return value offsets (match ranges) acquired from the givenMatchesIterator
.
-
-
-
Field Detail
-
field
private final java.lang.String field
-
analyzer
private final Analyzer analyzer
-
-
Constructor Detail
-
OffsetsFromPositions
OffsetsFromPositions(java.lang.String field, Analyzer analyzer)
-
-
Method Detail
-
get
public java.util.List<OffsetRange> get(MatchesIterator matchesIterator, MatchRegionRetriever.FieldValueProvider doc) throws java.io.IOException
Description copied from interface:OffsetsRetrievalStrategy
Return value offsets (match ranges) acquired from the givenMatchesIterator
.- Specified by:
get
in interfaceOffsetsRetrievalStrategy
- Throws:
java.io.IOException
-
convertPositionsToOffsets
java.util.List<OffsetRange> convertPositionsToOffsets(java.util.ArrayList<OffsetRange> positionRanges, java.util.List<java.lang.CharSequence> values) throws java.io.IOException
- Throws:
java.io.IOException
-
-