## org.apache.lucene.search
Class SingleTermEnum

    java.lang.Object
      org.apache.lucene.index.TermEnum
          org.apache.lucene.search.FilteredTermEnum
              org.apache.lucene.search.SingleTermEnum

All Implemented Interfaces:
  Closeable

    public class SingleTermEnum

extends FilteredTermEnum

Subclass of FilteredTermEnum for enumerating a single term.

This can be used by `MultiTermQuery`s that need only visit one term, but want to preserve MultiTermQuery semantics such as `MultiTermQuery.rewriteMethod`.

Field Summary

Fields inherited from class org.apache.lucene.search.FilteredTermEnum
`actualEnum, currentTerm`

Constructor Summary
`SingleTermEnum(IndexReader reader, Term singleTerm)` Creates a new `SingleTermEnum`.

Method Summary
`float` `difference()` Equality measure on the term
`protected boolean` `endEnum()` Indicates the end of the enumeration has been reached
`protected boolean` `termCompare(Term term)` Equality compare on the term

Methods inherited from class org.apache.lucene.search.FilteredTermEnum
`close, docFreq, next, setEnum, term`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SingleTermEnum

    public SingleTermEnum(IndexReader reader,
                          Term singleTerm)
                   throws IOException

  Creates a new `SingleTermEnum`.

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

  Throws:
    `IOException`

Method Detail

### difference

    public float difference()

  Description copied from class: `FilteredTermEnum`
  Equality measure on the term

  Specified by:
    `difference` in class `FilteredTermEnum`

### endEnum

    protected boolean endEnum()

  Description copied from class: `FilteredTermEnum`
  Indicates the end of the enumeration has been reached

  Specified by:
    `endEnum` in class `FilteredTermEnum`

### termCompare

    protected boolean termCompare(Term term)

  Description copied from class: `FilteredTermEnum`
  Equality compare on the term

  Specified by:
    `termCompare` in class `FilteredTermEnum`