OffsetsFromPositions (Lucene 10.5.1 highlighter API)
Description: declaration: package: org.apache.lucene.search.matchhighlight, class: OffsetsFromPositions

Package org.apache.lucene.search.matchhighlight

# Class OffsetsFromPositions

java.lang.Object
org.apache.lucene.search.matchhighlight.OffsetsFromPositions

All Implemented Interfaces:
  `OffsetsRetrievalStrategy`

public final class OffsetsFromPositions extends 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(String field, Analyzer analyzer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<OffsetRange>`
  `get(MatchesIterator matchesIterator, MatchRegionRetriever.FieldValueProvider doc)`
  Return value offsets (match ranges) acquired from the given `MatchesIterator`.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### OffsetsFromPositions

    public OffsetsFromPositions(String field, Analyzer analyzer)

- ## Method Details

  - ### get

    public List<OffsetRange> get(MatchesIterator matchesIterator, MatchRegionRetriever.FieldValueProvider doc) throws IOException
    Description copied from interface: `OffsetsRetrievalStrategy`
    Return value offsets (match ranges) acquired from the given `MatchesIterator`.
    Specified by:
      `get` in interface `OffsetsRetrievalStrategy`
    Throws:
      `IOException`