org.apache.lucene.index

## Class DocsEnum

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

- Direct Known Subclasses:
    DocsAndPositionsEnum, FilterAtomicReader.FilterDocsEnum, MappingMultiDocsEnum, MultiDocsEnum, Scorer

      public abstract class DocsEnum
      extends DocIdSetIterator

  Iterates through the documents and term freqs. NOTE: you must first call `DocIdSetIterator.nextDoc()` before using any of the per-doc methods.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FLAG_FREQS` Flag to pass to `TermsEnum.docs(Bits,DocsEnum,int)` if you require term frequencies in the returned enum.
    `static int` | `FLAG_NONE` Flag to pass to `TermsEnum.docs(Bits,DocsEnum,int)` if you don't require term frequencies in the returned enum.

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

      `NO_MORE_DOCS`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `AttributeSource` | `attributes()` Returns the related attributes.
    `abstract int` | `freq()` Returns term frequency in the current document, or 1 if the field was indexed with `FieldInfo.IndexOptions.DOCS_ONLY`.

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

      `advance, docID, nextDoc`

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

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

- - ### Field Detail

    - #### FLAG_NONE

          public static final int FLAG_NONE

      Flag to pass to `TermsEnum.docs(Bits,DocsEnum,int)` if you don't require term frequencies in the returned enum. When passed to `TermsEnum.docsAndPositions(Bits,DocsAndPositionsEnum,int)` means that no offsets and payloads will be returned.
      See Also:
        Constant Field Values

    - #### FLAG_FREQS

          public static final int FLAG_FREQS

      Flag to pass to `TermsEnum.docs(Bits,DocsEnum,int)` if you require term frequencies in the returned enum.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DocsEnum

          protected DocsEnum()

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

  - ### Method Detail

    - #### freq

          public abstract int freq()
                            throws IOException

      Returns term frequency in the current document, or 1 if the field was indexed with `FieldInfo.IndexOptions.DOCS_ONLY`. Do not call this before `DocIdSetIterator.nextDoc()` is first called, nor after `DocIdSetIterator.nextDoc()` returns `DocIdSetIterator.NO_MORE_DOCS`.

      NOTE: if the `DocsEnum` was obtain with `FLAG_NONE`, the result of this method is undefined.

      Throws:
        `IOException`

    - #### attributes

          public AttributeSource attributes()

      Returns the related attributes.

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