org.apache.lucene.index

## Class DocsAndPositionsEnum

- java.lang.Object
- - org.apache.lucene.search.DocIdSetIterator
  - - org.apache.lucene.index.PostingsEnum
    - - org.apache.lucene.index.DocsEnum
      - - org.apache.lucene.index.DocsAndPositionsEnum

- Deprecated.
  Use `PostingsEnum` instead.

      @Deprecated
      public abstract class DocsAndPositionsEnum
      extends DocsEnum

  Also iterates through positions.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FLAG_OFFSETS` Deprecated. Flag to pass to `TermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)` if you require offsets in the returned enum.
    `static int` | `FLAG_PAYLOADS` Deprecated. Flag to pass to `TermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)` if you require payloads in the returned enum.
    `static short` | `OLD_NULL_SEMANTICS` Deprecated. only for internal use.

    - ### Fields inherited from class org.apache.lucene.index.DocsEnum

      `FLAG_FREQS, FLAG_NONE`

    - ### Fields inherited from class org.apache.lucene.index.PostingsEnum

      `ALL, FREQS, NONE, OFFSETS, PAYLOADS, POSITIONS`

    - ### Fields inherited from class org.apache.lucene.search.DocIdSetIterator

      `NO_MORE_DOCS`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `DocsAndPositionsEnum()` Deprecated. Sole constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract int` | `endOffset()` Deprecated. Returns end offset for the current position, or -1 if offsets were not indexed.
    `abstract BytesRef` | `getPayload()` Deprecated. Returns the payload at this position, or null if no payload was indexed.
    `abstract int` | `nextPosition()` Deprecated. Returns the next position.
    `abstract int` | `startOffset()` Deprecated. Returns start offset for the current position, or -1 if offsets were not indexed.

    - ### Methods inherited from class org.apache.lucene.index.PostingsEnum

      `attributes, featureRequested, freq`

    - ### Methods inherited from class org.apache.lucene.search.DocIdSetIterator

      `advance, all, cost, docID, empty, nextDoc, slowAdvance`

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

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

- - ### Field Detail

    - #### FLAG_OFFSETS

          public static final int FLAG_OFFSETS

      Deprecated.
      Flag to pass to `TermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)` if you require offsets in the returned enum.
      See Also:
        Constant Field Values

    - #### FLAG_PAYLOADS

          public static final int FLAG_PAYLOADS

      Deprecated.
      Flag to pass to `TermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)` if you require payloads in the returned enum.
      See Also:
        Constant Field Values

    - #### OLD_NULL_SEMANTICS

          @Deprecated
          public static final short OLD_NULL_SEMANTICS

      Deprecated. only for internal use.
      Codec implementations should check for this flag, and return null when positions are requested but not present.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DocsAndPositionsEnum

          protected DocsAndPositionsEnum()

      Deprecated.
      Sole constructor. (For invocation by subclass constructors, typically implicit.)

  - ### Method Detail

    - #### nextPosition

          public abstract int nextPosition()
                                    throws IOException

      Deprecated.
      Returns the next position. You should only call this up to `PostingsEnum.freq()` times else the behavior is not defined. If positions were not indexed this will return -1; this only happens if offsets were indexed and you passed needsOffset=true when pulling the enum.
      Overrides:
        `nextPosition` in class `DocsEnum`
      Throws:
        `IOException`

    - #### startOffset

          public abstract int startOffset()
                                   throws IOException

      Deprecated.
      Returns start offset for the current position, or -1 if offsets were not indexed.
      Overrides:
        `startOffset` in class `DocsEnum`
      Throws:
        `IOException`

    - #### endOffset

          public abstract int endOffset()
                                 throws IOException

      Deprecated.
      Returns end offset for the current position, or -1 if offsets were not indexed.
      Overrides:
        `endOffset` in class `DocsEnum`
      Throws:
        `IOException`

    - #### getPayload

          public abstract BytesRef getPayload()
                                       throws IOException

      Deprecated.
      Returns the payload at this position, or null if no payload was indexed. You should not modify anything (neither members of the returned BytesRef nor bytes in the byte[]).
      Overrides:
        `getPayload` in class `DocsEnum`
      Throws:
        `IOException`

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