org.apache.lucene.index

## Class SingleTermsEnum

- java.lang.Object
- - org.apache.lucene.index.TermsEnum
  - - org.apache.lucene.index.FilteredTermsEnum
    - - org.apache.lucene.index.SingleTermsEnum

- All Implemented Interfaces:
    BytesRefIterator

      public final class SingleTermsEnum
      extends FilteredTermsEnum

  Subclass of FilteredTermsEnum for enumerating a single term.

  For example, this can be used by `MultiTermQuery`s that need only visit one term, but want to preserve MultiTermQuery semantics such as `MultiTermQuery.getRewriteMethod()`.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.apache.lucene.index.FilteredTermsEnum

      `FilteredTermsEnum.AcceptStatus`

    - ### Nested classes/interfaces inherited from class org.apache.lucene.index.TermsEnum

      `TermsEnum.SeekStatus`

  - ### Field Summary

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

      `EMPTY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleTermsEnum(TermsEnum tenum, BytesRef termText)` Creates a new `SingleTermsEnum`.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected FilteredTermsEnum.AcceptStatus` | `accept(BytesRef term)` Return if term is accepted, not accepted or the iteration should ended (and possibly seek).

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

      `attributes, docFreq, docs, docsAndPositions, getComparator, next, nextSeekTerm, ord, seekCeil, seekExact, seekExact, seekExact, setInitialSeekTerm, term, termState, totalTermFreq`

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

      `docs, docsAndPositions, seekCeil`

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

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

- - ### Constructor Detail

    - #### SingleTermsEnum

          public SingleTermsEnum(TermsEnum tenum,
                         BytesRef termText)

      Creates a new `SingleTermsEnum`.

      After calling the constructor the enumeration is already pointing to the term, if it exists.

  - ### Method Detail

    - #### accept

          protected FilteredTermsEnum.AcceptStatus accept(BytesRef term)

      Description copied from class: `FilteredTermsEnum`
      Return if term is accepted, not accepted or the iteration should ended (and possibly seek).
      Specified by:
        `accept` in class `FilteredTermsEnum`

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