org.apache.lucene.document

Class LongPoint

    • Constructor Detail

      • LongPoint

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

      • setLongValues

        public void setLongValues(long... point)
        Change the values of this field
      • encodeDimension

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

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

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

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

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

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

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

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

        Ranges are inclusive. For exclusive ranges, pass Math.addExact(lowerValue, 1) or Math.addExact(upperValue, -1).

        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,
                                          long[] lowerValue,
                                          long[] upperValue)
        Create a range query for n-dimensional long values.

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

        Ranges are inclusive. For exclusive ranges, pass Math.addExact(lowerValue[i], 1) or Math.addExact(upperValue[i], -1).

        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,
                                        long... 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<Long> 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