Class LongValuesSource

    • Constructor Detail

      • LongValuesSource

        public LongValuesSource()
    • Method Detail

      • getValues

        public abstract LongValues getValues​(LeafReaderContext ctx,
                                             DoubleValues scores)
                                      throws java.io.IOException
        Returns a LongValues instance for the passed-in LeafReaderContext and scores If scores are not needed to calculate the values (ie returns false, callers may safely pass null for the scores parameter.
        Throws:
        java.io.IOException
      • needsScores

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

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

        public abstract boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public abstract java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • rewrite

        public abstract LongValuesSource rewrite​(IndexSearcher searcher)
                                          throws java.io.IOException
        Return a LongValuesSource specialised for the given IndexSearcher Implementations should assume that this will only be called once. IndexSearcher-independent implementations can just return this
        Throws:
        java.io.IOException
      • 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
      • toDoubleValuesSource

        public DoubleValuesSource toDoubleValuesSource()
        Convert to a DoubleValuesSource by casting long values to doubles
      • fromLongField

        public static LongValuesSource fromLongField​(java.lang.String field)
        Creates a LongValuesSource that wraps a long-valued field
      • fromIntField

        public static LongValuesSource fromIntField​(java.lang.String field)
        Creates a LongValuesSource that wraps an int-valued field
      • constant

        public static LongValuesSource constant​(long value)
        Creates a LongValuesSource that always returns a constant value