org.apache.lucene.search

## Class DocValuesRangeQuery

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.DocValuesRangeQuery

- All Implemented Interfaces:
    Cloneable

      public final class DocValuesRangeQuery
      extends Query

  A range query that works on top of the doc values APIs. Such queries are usually slow since they do not use an inverted index. However, in the dense case where most documents match this query, it might be as fast or faster than a regular `NumericRangeQuery`.

  NOTE: be very careful using this query: it is typically much slower than using `TermsQuery`, but in certain specialized cases may be faster.

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

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Weight` | `createWeight(IndexSearcher searcher, boolean needsScores)`
    `boolean` | `equals(Object obj)`
    `int` | `hashCode()`
    `static Query` | `newBytesRefRange(String field, BytesRef lowerVal, BytesRef upperVal, boolean includeLower, boolean includeUpper)` Create a new numeric range query on a numeric doc-values field.
    `static Query` | `newLongRange(String field, Long lowerVal, Long upperVal, boolean includeLower, boolean includeUpper)` Create a new numeric range query on a numeric doc-values field.
    `Query` | `rewrite(IndexReader reader)`
    `String` | `toString(String field)`

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

      `clone, getBoost, setBoost, toString`

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

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### newLongRange

          public static Query newLongRange(String field,
                           Long lowerVal,
                           Long upperVal,
                           boolean includeLower,
                           boolean includeUpper)

      Create a new numeric range query on a numeric doc-values field. The field must has been indexed with either `DocValuesType.NUMERIC` or `DocValuesType.SORTED_NUMERIC` doc values.

    - #### newBytesRefRange

          public static Query newBytesRefRange(String field,
                               BytesRef lowerVal,
                               BytesRef upperVal,
                               boolean includeLower,
                               boolean includeUpper)

      Create a new numeric range query on a numeric doc-values field. The field must has been indexed with `DocValuesType.SORTED` or `DocValuesType.SORTED_SET` doc values.

    - #### equals

          public boolean equals(Object obj)

      Overrides:
        `equals` in class `Query`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Query`

    - #### toString

          public String toString(String field)

      Specified by:
        `toString` in class `Query`

    - #### rewrite

          public Query rewrite(IndexReader reader)
                        throws IOException

      Overrides:
        `rewrite` in class `Query`
      Throws:
        `IOException`

    - #### createWeight

          public Weight createWeight(IndexSearcher searcher,
                            boolean needsScores)
                              throws IOException

      Overrides:
        `createWeight` in class `Query`
      Throws:
        `IOException`

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