Class FloatField

    • Constructor Detail

      • FloatField

        public FloatField​(String name,
                          float value,
                          Field.Store stored)
        Creates a new FloatField, indexing the provided point, storing it as a DocValue, and optionally storing it as a stored field.
        Parameters:
        name - field name
        value - the float value
        stored - whether to store the field
        Throws:
        IllegalArgumentException - if the field name or value is null.
    • Method Detail

      • toString

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

        public static Query newExactQuery​(String field,
                                          float value)
        Create a query for matching an exact float value.
        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,
                                          float lowerValue,
                                          float upperValue)
        Create a range query for float values.

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

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

        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.
      • newSetQuery

        public static Query newSetQuery​(String field,
                                        float... values)
        Create a query matching values in a supplied set
        Parameters:
        field - field name. must not be null.
        values - float values
        Returns:
        a query matching documents within this set.
        Throws:
        IllegalArgumentException - if field is null.
      • newSortField

        public static SortField newSortField​(String field,
                                             boolean reverse,
                                             SortedNumericSelector.Type selector)
        Create a new SortField for float values.
        Parameters:
        field - field name. must not be null.
        reverse - true if natural order should be reversed.
        selector - custom selector type for choosing the sort value from the set.