Class DoublePoint

    • Constructor Detail

      • DoublePoint

        public DoublePoint​(String name,
                           double... point)
        Creates a new DoublePoint, indexing the provided N-dimensional double point.
        Parameters:
        name - field name
        point - double[] value
        Throws:
        IllegalArgumentException - if the field name or value is null.
    • Method Detail

      • nextUp

        public static double nextUp​(double d)
        Return the least double that compares greater than d consistently with Double.compare(double, double). The only difference with Math.nextUp(double) is that this method returns +0d when the argument is -0d.
      • nextDown

        public static double nextDown​(double d)
        Return the greatest double that compares less than d consistently with Double.compare(double, double). The only difference with Math.nextDown(double) is that this method returns -0d when the argument is +0d.
      • setDoubleValues

        public void setDoubleValues​(double... point)
        Change the values of this field
      • setBytesValue

        public void setBytesValue​(BytesRef bytes)
        Description copied from class: Field
        Expert: change the value of this field. See Field.setStringValue(String).

        NOTE: the provided BytesRef is not copied so be sure not to change it until you're done with this field.

        Overrides:
        setBytesValue in class Field
      • pack

        public static BytesRef pack​(double... point)
        Pack a double point into a BytesRef
        Parameters:
        point - double[] value
        Throws:
        IllegalArgumentException - is the value is null or of zero length
      • toString

        public String toString()
        Description copied from class: Field
        Prints a Field for human consumption.
        Overrides:
        toString in class Field
      • encodeDimension

        public static void encodeDimension​(double value,
                                           byte[] dest,
                                           int offset)
        Encode single double dimension
      • decodeDimension

        public static double decodeDimension​(byte[] value,
                                             int offset)
        Decode single double dimension
      • newExactQuery

        public static Query newExactQuery​(String field,
                                          double value)
        Create a query for matching an exact double value.

        This is for simple one-dimension points, for multidimensional points use newRangeQuery(String, double[], double[]) instead.

        Parameters:
        field - field name. must not be null.
        value - double value
        Returns:
        a query matching documents with this exact value
        Throws:
        IllegalArgumentException - if field is null.
      • newRangeQuery

        public static Query newRangeQuery​(String field,
                                          double lowerValue,
                                          double upperValue)
        Create a range query for double values.

        This is for simple one-dimension ranges, for multidimensional ranges use newRangeQuery(String, double[], double[]) instead.

        You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting lowerValue = Double.NEGATIVE_INFINITY or upperValue = Double.POSITIVE_INFINITY.

        Ranges are inclusive. For exclusive ranges, pass nextUp(lowerValue) or nextDown(upperValue).

        Range comparisons are consistent with Double.compareTo(Double).

        Parameters:
        field - field name. must not be null.
        lowerValue - lower portion of the range (inclusive).
        upperValue - upper portion of the range (inclusive).
        Returns:
        a query matching documents within this range.
        Throws:
        IllegalArgumentException - if field is null.
      • newRangeQuery

        public static Query newRangeQuery​(String field,
                                          double[] lowerValue,
                                          double[] upperValue)
        Create a range query for n-dimensional double values.

        You can have half-open ranges (which are in fact </≤ or >/≥ queries) by setting lowerValue[i] = Double.NEGATIVE_INFINITY or upperValue[i] = Double.POSITIVE_INFINITY.

        Ranges are inclusive. For exclusive ranges, pass Math#nextUp(lowerValue[i]) or Math.nextDown(upperValue[i]).

        Range comparisons are consistent with Double.compareTo(Double).

        Parameters:
        field - field name. must not be null.
        lowerValue - lower portion of the range (inclusive). must not be null.
        upperValue - upper portion of the range (inclusive). must not be null.
        Returns:
        a query matching documents within this range.
        Throws:
        IllegalArgumentException - if field is null, if lowerValue is null, if upperValue is null, or if lowerValue.length != upperValue.length
      • newSetQuery

        public static Query newSetQuery​(String field,
                                        double... values)
        Create a query matching any of the specified 1D values. This is the points equivalent of TermsQuery.
        Parameters:
        field - field name. must not be null.
        values - all values to match
      • newSetQuery

        public static Query newSetQuery​(String field,
                                        Collection<Double> values)
        Create a query matching any of the specified 1D values. This is the points equivalent of TermsQuery.
        Parameters:
        field - field name. must not be null.
        values - all values to match