Package org.apache.lucene.search

# Class DocValuesRangeIterator

java.lang.Object
org.apache.lucene.search.TwoPhaseIterator
org.apache.lucene.search.DocValuesRangeIterator

public final class DocValuesRangeIterator extends TwoPhaseIterator
Wrapper around a `TwoPhaseIterator` for a doc-values range query that speeds things up by taking advantage of a `DocValuesSkipper`.

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DocValuesRangeIterator(TwoPhaseIterator twoPhase, DocValuesSkipper skipper, long lowerValue, long upperValue, boolean queryRangeHasGaps)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `docIDRunEnd()`
  Returns the end of the run of consecutive doc IDs that match this `TwoPhaseIterator` and that contains the current doc ID of the approximation, that is: one plus the last doc ID of the run.
  `float`
  `matchCost()`
  An estimate of the expected cost to determine that a single document `TwoPhaseIterator.matches()`.
  `final boolean`
  `matches()`
  Return whether the current doc ID that `TwoPhaseIterator.approximation()` is on matches.

  ### Methods inherited from class org.apache.lucene.search.TwoPhaseIterator

  `approximation, asDocIdSetIterator, unwrap`

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

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

- ## Constructor Details

  - ### DocValuesRangeIterator

    public DocValuesRangeIterator(TwoPhaseIterator twoPhase, DocValuesSkipper skipper, long lowerValue, long upperValue, boolean queryRangeHasGaps)

- ## Method Details

  - ### matches

    public final boolean matches() throws IOException
    Description copied from class: `TwoPhaseIterator`
    Return whether the current doc ID that `TwoPhaseIterator.approximation()` is on matches. This method should only be called when the iterator is positioned -- ie. not when `DocIdSetIterator.docID()` is `-1` or `DocIdSetIterator.NO_MORE_DOCS` -- and at most once.
    Specified by:
      `matches` in class `TwoPhaseIterator`
    Throws:
      `IOException`

  - ### docIDRunEnd

    public int docIDRunEnd() throws IOException
    Description copied from class: `TwoPhaseIterator`
    Returns the end of the run of consecutive doc IDs that match this `TwoPhaseIterator` and that contains the current doc ID of the approximation, that is: one plus the last doc ID of the run.

    Note: It is illegal to call this method when the approximation is exhausted or not positioned.

    The default implementation returns the current doc ID of the approximation.

    Overrides:
      `docIDRunEnd` in class `TwoPhaseIterator`
    Throws:
      `IOException`

  - ### matchCost

    public float matchCost()
    Description copied from class: `TwoPhaseIterator`
    An estimate of the expected cost to determine that a single document `TwoPhaseIterator.matches()`. This can be called before iterating the documents of `TwoPhaseIterator.approximation()`. Returns an expected cost in number of simple operations like addition, multiplication, comparing two numbers and indexing an array. The returned value must be positive.
    Specified by:
      `matchCost` in class `TwoPhaseIterator`