Class NumericRangeQuery<T extends Number>

    • Method Detail

      • newLongRange

        public static NumericRangeQuery<Long> newLongRange​(String field,
                                                           int precisionStep,
                                                           Long min,
                                                           Long max,
                                                           boolean minInclusive,
                                                           boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries 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 NumericRangeQuery<Long> newLongRange​(String field,
                                                           Long min,
                                                           Long max,
                                                           boolean minInclusive,
                                                           boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries a long range using the default precisionStep NumericUtils.PRECISION_STEP_DEFAULT (4). 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 NumericRangeQuery<Integer> newIntRange​(String field,
                                                             int precisionStep,
                                                             Integer min,
                                                             Integer max,
                                                             boolean minInclusive,
                                                             boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries 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 NumericRangeQuery<Integer> newIntRange​(String field,
                                                             Integer min,
                                                             Integer max,
                                                             boolean minInclusive,
                                                             boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries a int range using the default precisionStep NumericUtils.PRECISION_STEP_DEFAULT (4). 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 NumericRangeQuery<Double> newDoubleRange​(String field,
                                                               int precisionStep,
                                                               Double min,
                                                               Double max,
                                                               boolean minInclusive,
                                                               boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries 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 NumericRangeQuery<Double> newDoubleRange​(String field,
                                                               Double min,
                                                               Double max,
                                                               boolean minInclusive,
                                                               boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries a double range using the default precisionStep NumericUtils.PRECISION_STEP_DEFAULT (4). 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 NumericRangeQuery<Float> newFloatRange​(String field,
                                                             int precisionStep,
                                                             Float min,
                                                             Float max,
                                                             boolean minInclusive,
                                                             boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries 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 NumericRangeQuery<Float> newFloatRange​(String field,
                                                             Float min,
                                                             Float max,
                                                             boolean minInclusive,
                                                             boolean maxInclusive)
        Factory that creates a NumericRangeQuery, that queries a float range using the default precisionStep NumericUtils.PRECISION_STEP_DEFAULT (4). 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.
      • getField

        public String getField()
        Returns the field name for this query
      • includesMin

        public boolean includesMin()
        Returns true if the lower endpoint is inclusive
      • includesMax

        public boolean includesMax()
        Returns true if the upper endpoint is inclusive
      • getMin

        public T getMin()
        Returns the lower value of this range query
      • getMax

        public T getMax()
        Returns the upper value of this range query
      • getPrecisionStep

        public int getPrecisionStep()
        Returns the precision step.
      • toString

        public String toString​(String field)
        Description copied from class: Query
        Prints a query to a string, with field assumed to be the default field and omitted.

        The representation used is one that is supposed to be readable by QueryParser. However, there are the following limitations:

        • If the query was created by the parser, the printed representation may not be exactly what was parsed. For example, characters that need to be escaped will be represented without the required backslash.
        • Some of the more complicated queries (e.g. span queries) don't have a representation that can be parsed by QueryParser.
        Specified by:
        toString in class Query