org.apache.lucene.search

## Class NumericRangeFilter<T extends Number>

- java.lang.Object
- - org.apache.lucene.search.Query
  - - org.apache.lucene.search.Filter
    - - org.apache.lucene.search.MultiTermQueryWrapperFilter<NumericRangeQuery<T>>
      - - org.apache.lucene.search.NumericRangeFilter<T>

- All Implemented Interfaces:
    Cloneable

  Deprecated.
  Use `NumericRangeQuery` and `BooleanClause.Occur.FILTER` clauses instead.

      @Deprecated
      public final class NumericRangeFilter<T extends Number>
      extends MultiTermQueryWrapperFilter<NumericRangeQuery<T>>

  A `Filter` that only accepts numeric values within a specified range. To use this, you must first index the numeric values using `IntField`, `FloatField`, `LongField` or `DoubleField` (expert: `NumericTokenStream`).

  You create a new NumericRangeFilter with the static factory methods, eg:

       Filter f = NumericRangeFilter.newFloatRange("weight", 0.03f, 0.10f, true, true);

  accepts all documents whose float valued "weight" field ranges from 0.03 to 0.10, inclusive. See `NumericRangeQuery` for details on how Lucene indexes and searches numeric valued fields.
  Since:
    2.9

- - ### Field Summary

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

      `query`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `getMax()` Deprecated. Returns the upper value of this range filter
    `T` | `getMin()` Deprecated. Returns the lower value of this range filter
    `int` | `getPrecisionStep()` Deprecated. Returns the precision step.
    `boolean` | `includesMax()` Deprecated. Returns `true` if the upper endpoint is inclusive
    `boolean` | `includesMin()` Deprecated. Returns `true` if the lower endpoint is inclusive
    `static NumericRangeFilter<Double>` | `newDoubleRange(String field, Double min, Double max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that queries a `double` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT` (16).
    `static NumericRangeFilter<Double>` | `newDoubleRange(String field, int precisionStep, Double min, Double max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that filters a `double` range using the given `precisionStep`.
    `static NumericRangeFilter<Float>` | `newFloatRange(String field, Float min, Float max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that queries a `float` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT_32` (8).
    `static NumericRangeFilter<Float>` | `newFloatRange(String field, int precisionStep, Float min, Float max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that filters a `float` range using the given `precisionStep`.
    `static NumericRangeFilter<Integer>` | `newIntRange(String field, Integer min, Integer max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that queries a `int` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT_32` (8).
    `static NumericRangeFilter<Integer>` | `newIntRange(String field, int precisionStep, Integer min, Integer max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that filters a `int` range using the given `precisionStep`.
    `static NumericRangeFilter<Long>` | `newLongRange(String field, int precisionStep, Long min, Long max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that filters a `long` range using the given `precisionStep`.
    `static NumericRangeFilter<Long>` | `newLongRange(String field, Long min, Long max, boolean minInclusive, boolean maxInclusive)` Deprecated. Factory that creates a `NumericRangeFilter`, that queries a `long` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT` (16).

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

      `equals, getDocIdSet, getField, hashCode, toString`

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

      `rewrite`

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

      `clone, createWeight, getBoost, setBoost, toString`

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

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

- - ### Method Detail

    - #### newLongRange

          public static NumericRangeFilter<Long> newLongRange(String field,
                                              int precisionStep,
                                              Long min,
                                              Long max,
                                              boolean minInclusive,
                                              boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that filters a `long` range using the given `precisionStep`. You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newLongRange

          public static NumericRangeFilter<Long> newLongRange(String field,
                                              Long min,
                                              Long max,
                                              boolean minInclusive,
                                              boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that queries a `long` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT` (16). You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newIntRange

          public static NumericRangeFilter<Integer> newIntRange(String field,
                                                int precisionStep,
                                                Integer min,
                                                Integer max,
                                                boolean minInclusive,
                                                boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that filters a `int` range using the given `precisionStep`. You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newIntRange

          public static NumericRangeFilter<Integer> newIntRange(String field,
                                                Integer min,
                                                Integer max,
                                                boolean minInclusive,
                                                boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that queries a `int` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT_32` (8). You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newDoubleRange

          public static NumericRangeFilter<Double> newDoubleRange(String field,
                                                  int precisionStep,
                                                  Double min,
                                                  Double max,
                                                  boolean minInclusive,
                                                  boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that filters a `double` range using the given `precisionStep`. You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. `Double.NaN` will never match a half-open range, to hit `NaN` use a query with `min == max == Double.NaN`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newDoubleRange

          public static NumericRangeFilter<Double> newDoubleRange(String field,
                                                  Double min,
                                                  Double max,
                                                  boolean minInclusive,
                                                  boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that queries a `double` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT` (16). You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. `Double.NaN` will never match a half-open range, to hit `NaN` use a query with `min == max == Double.NaN`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newFloatRange

          public static NumericRangeFilter<Float> newFloatRange(String field,
                                                int precisionStep,
                                                Float min,
                                                Float max,
                                                boolean minInclusive,
                                                boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that filters a `float` range using the given `precisionStep`. You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. `Float.NaN` will never match a half-open range, to hit `NaN` use a query with `min == max == Float.NaN`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### newFloatRange

          public static NumericRangeFilter<Float> newFloatRange(String field,
                                                Float min,
                                                Float max,
                                                boolean minInclusive,
                                                boolean maxInclusive)

      Deprecated.
      Factory that creates a `NumericRangeFilter`, that queries a `float` range using the default `precisionStep` `NumericUtils.PRECISION_STEP_DEFAULT_32` (8). You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting the min or max value to `null`. `Float.NaN` will never match a half-open range, to hit `NaN` use a query with `min == max == Float.NaN`. By setting inclusive to false, it will match all documents excluding the bounds, with inclusive on, the boundaries are hits, too.

    - #### includesMin

          public boolean includesMin()

      Deprecated.
      Returns `true` if the lower endpoint is inclusive

    - #### includesMax

          public boolean includesMax()

      Deprecated.
      Returns `true` if the upper endpoint is inclusive

    - #### getMin

          public T getMin()

      Deprecated.
      Returns the lower value of this range filter

    - #### getMax

          public T getMax()

      Deprecated.
      Returns the upper value of this range filter

    - #### getPrecisionStep

          public int getPrecisionStep()

      Deprecated.
      Returns the precision step.

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