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

Package org.apache.lucene.search.matchhighlight

# Class OffsetsFromTokens

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

All Implemented Interfaces:
  `OffsetsRetrievalStrategy`

public final class OffsetsFromTokens extends Object implements OffsetsRetrievalStrategy
This strategy works for fields where we know the match occurred but there are no known positions or offsets.

We re-analyze field values and return offset ranges for returned tokens that are also returned by the query's term collector.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OffsetsFromTokens(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

  - ### OffsetsFromTokens

    public OffsetsFromTokens(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`