org.apache.lucene.search.uhighlight

## Class OffsetsEnum

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, Comparable<OffsetsEnum>
  Direct Known Subclasses:
    OffsetsEnum.MultiOffsetsEnum, OffsetsEnum.OfMatchesIterator, OffsetsEnum.OfMatchesIteratorWithSubs, OffsetsEnum.OfPostings

      public abstract class OffsetsEnum
      extends Object
      implements Comparable<OffsetsEnum>, Closeable

  An enumeration/iterator of a term and its offsets for use by `FieldHighlighter`. It is advanced and is placed in a priority queue by `FieldHighlighter.highlightOffsetsEnums(OffsetsEnum)` based on the start offset.
  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `OffsetsEnum.MultiOffsetsEnum` A view over several OffsetsEnum instances, merging them in-place
    `static class` | `OffsetsEnum.OfMatchesIterator` Based on a `MatchesIterator`; does not look at submatches.
    `static class` | `OffsetsEnum.OfMatchesIteratorWithSubs` Based on a `MatchesIterator` with submatches.
    `static class` | `OffsetsEnum.OfPostings` Based on a `PostingsEnum` -- the typical/standard OE impl.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static OffsetsEnum` | `EMPTY` Empty enumeration

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OffsetsEnum()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `int` | `compareTo(OffsetsEnum other)`
    `abstract int` | `endOffset()`
    `abstract int` | `freq()` An estimate of the number of occurrences of this term/OffsetsEnum.
    `abstract BytesRef` | `getTerm()` The term at this position.
    `abstract boolean` | `nextPosition()` Advances to the next position and returns true, or if can't then returns false.
    `abstract int` | `startOffset()`
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### EMPTY

          public static final OffsetsEnum EMPTY

      Empty enumeration

  - ### Constructor Detail

    - #### OffsetsEnum

          public OffsetsEnum()

  - ### Method Detail

    - #### compareTo

          public int compareTo(OffsetsEnum other)

      Specified by:
        `compareTo` in interface `Comparable<OffsetsEnum>`

    - #### nextPosition

          public abstract boolean nextPosition()
                                        throws IOException

      Advances to the next position and returns true, or if can't then returns false. Note that the initial state of this class is not positioned.
      Throws:
        `IOException`

    - #### freq

          public abstract int freq()
                            throws IOException

      An estimate of the number of occurrences of this term/OffsetsEnum.
      Throws:
        `IOException`

    - #### getTerm

          public abstract BytesRef getTerm()
                                    throws IOException

      The term at this position. This BytesRef is safe to continue to refer to, even after we move to the next position.
      Throws:
        `IOException`
      See Also:
        `Passage.getMatchTerms()`

    - #### startOffset

          public abstract int startOffset()
                                   throws IOException

      Throws:
        `IOException`

    - #### endOffset

          public abstract int endOffset()
                                 throws IOException

      Throws:
        `IOException`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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