org.apache.lucene.search

## Class LongValuesSource

- java.lang.Object
- - org.apache.lucene.search.LongValuesSource

-     public abstract class LongValuesSource
      extends Object

  Base class for producing `LongValues` To obtain a `LongValues` object for a leaf reader, clients should call `getValues(LeafReaderContext, DoubleValues)`. LongValuesSource objects for long and int-valued NumericDocValues fields can be obtained by calling `fromLongField(String)` and `fromIntField(String)`. To obtain a LongValuesSource from a float or double-valued NumericDocValues field, use `DoubleValuesSource.fromFloatField(String)` or `DoubleValuesSource.fromDoubleField(String)` and then call `DoubleValuesSource.toLongValuesSource()`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LongValuesSource()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static LongValuesSource` | `constant(long value)` Creates a LongValuesSource that always returns a constant value
    `static LongValuesSource` | `fromIntField(String field)` Creates a LongValuesSource that wraps an int-valued field
    `static LongValuesSource` | `fromLongField(String field)` Creates a LongValuesSource that wraps a long-valued field
    `SortField` | `getSortField(boolean reverse)` Create a sort field based on the value of this producer
    `abstract LongValues` | `getValues(LeafReaderContext ctx, DoubleValues scores)` 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.
    `abstract boolean` | `needsScores()` Return true if document scores are needed to calculate values

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LongValuesSource

          public LongValuesSource()

  - ### Method Detail

    - #### getValues

          public abstract LongValues getValues(LeafReaderContext ctx,
                                               DoubleValues scores)
                                        throws 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:
        `IOException`

    - #### 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

    - #### fromLongField

          public static LongValuesSource fromLongField(String field)

      Creates a LongValuesSource that wraps a long-valued field

    - #### fromIntField

          public static LongValuesSource fromIntField(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

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.