Package org.apache.lucene.search

# Class LongValuesSource.ConstantLongValuesSource

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

All Implemented Interfaces:
  `SegmentCacheable`

Enclosing class:
  `LongValuesSource`

public static class LongValuesSource.ConstantLongValuesSource extends LongValuesSource
A ConstantLongValuesSource that always returns a constant value

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class org.apache.lucene.search.LongValuesSource

  `LongValuesSource.ConstantLongValuesSource`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `long`
  `getValue()`
  Get the constant value.
  `LongValues`
  `getValues(LeafReaderContext ctx, DoubleValues scores)`
  Returns a `LongValues` instance for the passed-in LeafReaderContext and scores
  `int`
  `hashCode()`
  `boolean`
  `isCacheable(LeafReaderContext ctx)`
  `boolean`
  `needsScores()`
  Return true if document scores are needed to calculate values
  `LongValuesSource`
  `rewrite(IndexSearcher searcher)`
  Return a LongValuesSource specialised for the given IndexSearcher
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.search.LongValuesSource

  `constant, fromIntField, fromLongField, getSortField, toDoubleValuesSource`

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

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### getValues

    public LongValues getValues(LeafReaderContext ctx, DoubleValues scores) throws IOException
    Description copied from class: `LongValuesSource`
    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.

    Specified by:
      `getValues` in class `LongValuesSource`
    Throws:
      `IOException`

  - ### isCacheable

    public boolean isCacheable(LeafReaderContext ctx)
    Returns:
      `true` if the object can be cached against a given leaf

  - ### needsScores

    public boolean needsScores()
    Description copied from class: `LongValuesSource`
    Return true if document scores are needed to calculate values
    Specified by:
      `needsScores` in class `LongValuesSource`

  - ### hashCode

    public int hashCode()
    Specified by:
      `hashCode` in class `LongValuesSource`

  - ### equals

    public boolean equals(Object o)
    Specified by:
      `equals` in class `LongValuesSource`

  - ### toString

    public String toString()
    Specified by:
      `toString` in class `LongValuesSource`

  - ### rewrite

    public LongValuesSource rewrite(IndexSearcher searcher) throws IOException
    Description copied from class: `LongValuesSource`
    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`

    Specified by:
      `rewrite` in class `LongValuesSource`
    Throws:
      `IOException`

  - ### getValue

    public long getValue()
    Get the constant value.