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

Package org.apache.lucene.search.uhighlight

# Class AnalysisOffsetStrategy

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

Direct Known Subclasses:
  `MemoryIndexOffsetStrategy`, `TokenStreamOffsetStrategy`

public abstract class AnalysisOffsetStrategy extends FieldOffsetStrategy
Provides a base class for analysis based offset strategies to extend from. Requires an Analyzer and provides an override-able method for altering how the TokenStream is created.

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 Analyzer`
  `analyzer`

  ### Fields inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy

  `components`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AnalysisOffsetStrategy(UHComponents components, Analyzer analyzer)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final UnifiedHighlighter.OffsetSource`
  `getOffsetSource()`
  `protected TokenStream`
  `tokenStream(String content)`

  ### Methods inherited from class org.apache.lucene.search.uhighlight.FieldOffsetStrategy

  `createOffsetsEnumFromReader, createOffsetsEnumsForAutomata, createOffsetsEnumsForTerms, createOffsetsEnumsWeightMatcher, getField, getOffsetsEnum`

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

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

- ## Field Details

  - ### analyzer

    protected final Analyzer analyzer

- ## Constructor Details

  - ### AnalysisOffsetStrategy

    public AnalysisOffsetStrategy(UHComponents components, Analyzer analyzer)

- ## Method Details

  - ### getOffsetSource

    public final UnifiedHighlighter.OffsetSource getOffsetSource()
    Specified by:
      `getOffsetSource` in class `FieldOffsetStrategy`

  - ### tokenStream

    protected TokenStream tokenStream(String content) throws IOException
    Throws:
      `IOException`