Package 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
  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
  Description
  `static final OffsetsEnum`
  `EMPTY`
  Empty enumeration

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `OffsetsEnum()`

- ## Method Summary

  Modifier and Type
  Method
  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 Details

  - ### EMPTY

    public static final OffsetsEnum EMPTY
    Empty enumeration

- ## Constructor Details

  - ### OffsetsEnum

    public OffsetsEnum()

- ## Method Details

  - ### 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 `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`