Class DoubleValuesSource

    • Constructor Detail

      • DoubleValuesSource

        public DoubleValuesSource()
    • Method Detail

      • needsScores

        public abstract boolean needsScores()
        Return true if document scores are needed to calculate values
      • getSortField

        public SortField getSortField​(boolean reverse)
        Create a sort field based on the value of this producer
        Parameters:
        reverse - true if the sort should be decreasing
      • hashCode

        public abstract int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public abstract boolean equals​(Object obj)
        Overrides:
        equals in class Object
      • toLongValuesSource

        public final LongValuesSource toLongValuesSource()
        Convert to a LongValuesSource by casting the double values to longs
      • fromField

        public static DoubleValuesSource fromField​(String field,
                                                   LongToDoubleFunction decoder)
        Creates a DoubleValuesSource that wraps a generic NumericDocValues field
        Parameters:
        field - the field to wrap, must have NumericDocValues
        decoder - a function to convert the long-valued doc values to doubles
      • fromDoubleField

        public static DoubleValuesSource fromDoubleField​(String field)
        Creates a DoubleValuesSource that wraps a double-valued field
      • fromFloatField

        public static DoubleValuesSource fromFloatField​(String field)
        Creates a DoubleValuesSource that wraps a float-valued field
      • fromLongField

        public static DoubleValuesSource fromLongField​(String field)
        Creates a DoubleValuesSource that wraps a long-valued field
      • fromIntField

        public static DoubleValuesSource fromIntField​(String field)
        Creates a DoubleValuesSource that wraps an int-valued field
      • constant

        public static DoubleValuesSource constant​(double value)
        Creates a DoubleValuesSource that always returns a constant value
      • fromScorer

        public static DoubleValues fromScorer​(Scorer scorer)
        Returns a DoubleValues instance that wraps scores returned by a Scorer
      • fromQuery

        public static DoubleValuesSource fromQuery​(Query query)
        Create a DoubleValuesSource that returns the score of a particular query