org.apache.lucene.search.uhighlight

## Class FieldOffsetStrategy

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

- Direct Known Subclasses:
    AnalysisOffsetStrategy, 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 and Description
    --- | ---
    `protected UHComponents` | `components`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FieldOffsetStrategy(UHComponents components)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and 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 Detail

    - #### components

          protected final UHComponents components

  - ### Constructor Detail

    - #### FieldOffsetStrategy

          public FieldOffsetStrategy(UHComponents components)

  - ### Method Detail

    - #### 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`

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.