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

Package org.apache.lucene.search.uhighlight

# Class FieldOffsetStrategy

java.lang.Object
org.apache.lucene.search.uhighlight.FieldOffsetStrategy

Direct Known Subclasses:
  `AnalysisOffsetStrategy`, `MultiFieldsOffsetStrategy`, `NoOpOffsetStrategy`, `PostingsOffsetStrategy`, `PostingsWithTermVectorsOffsetStrategy`, `TermVectorOffsetStrategy`

public abstract class FieldOffsetStrategy extends Object
Ultimately returns an `OffsetsEnum` yielding potentially highlightable words in the text. Needs information about the query up front.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final UHComponents`
  `components`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `FieldOffsetStrategy(UHComponents components)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected OffsetsEnum`
  `createOffsetsEnumFromReader(LeafReader leafReader, int doc)`
  `protected void`
  `createOffsetsEnumsForAutomata(Terms termsIndex, int doc, List<OffsetsEnum> results)`
  `protected void`
  `createOffsetsEnumsForTerms(BytesRef[] sourceTerms, Terms termsIndex, int doc, List<OffsetsEnum> results)`
  `protected void`
  `createOffsetsEnumsWeightMatcher(LeafReader _leafReader, int docId, List<OffsetsEnum> results)`
  `String`
  `getField()`
  `abstract OffsetsEnum`
  `getOffsetsEnum(LeafReader reader, int docId, String content)`
  The primary method -- return offsets for highlightable words in the specified document.
  `abstract UnifiedHighlighter.OffsetSource`
  `getOffsetSource()`

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

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

- ## Field Details

  - ### components

    protected final UHComponents components

- ## Constructor Details

  - ### FieldOffsetStrategy

    public FieldOffsetStrategy(UHComponents components)

- ## Method Details

  - ### getField

    public String getField()

  - ### getOffsetSource

    public abstract UnifiedHighlighter.OffsetSource getOffsetSource()

  - ### getOffsetsEnum

    public abstract OffsetsEnum getOffsetsEnum(LeafReader reader, int docId, String content) throws IOException
    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

    Throws:
      `IOException`

  - ### createOffsetsEnumFromReader

    protected OffsetsEnum createOffsetsEnumFromReader(LeafReader leafReader, int doc) throws IOException
    Throws:
      `IOException`

  - ### createOffsetsEnumsWeightMatcher

    protected void createOffsetsEnumsWeightMatcher(LeafReader _leafReader, int docId, List<OffsetsEnum> results) throws IOException
    Throws:
      `IOException`

  - ### createOffsetsEnumsForTerms

    protected void createOffsetsEnumsForTerms(BytesRef[] sourceTerms, Terms termsIndex, int doc, List<OffsetsEnum> results) throws IOException
    Throws:
      `IOException`

  - ### createOffsetsEnumsForAutomata

    protected void createOffsetsEnumsForAutomata(Terms termsIndex, int doc, List<OffsetsEnum> results) throws IOException
    Throws:
      `IOException`