TFValueSource (Lucene 10.5.0 queries API)
Description: declaration: package: org.apache.lucene.queries.function.valuesource, class: TFValueSource

Package org.apache.lucene.queries.function.valuesource

# Class TFValueSource

java.lang.Object
org.apache.lucene.queries.function.ValueSource
org.apache.lucene.queries.function.valuesource.DocFreqValueSource
org.apache.lucene.queries.function.valuesource.TermFreqValueSource
org.apache.lucene.queries.function.valuesource.TFValueSource

public class TFValueSource extends TermFreqValueSource
Function that returns `TFIDFSimilarity.tf(float)` for every document.

Note that the configured Similarity for the field must be a subclass of `TFIDFSimilarity`

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

- ## Field Summary

  ### Fields inherited from class org.apache.lucene.queries.function.valuesource.DocFreqValueSource

  `field, indexedBytes, indexedField, val`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TFValueSource(String field, String val, String indexedField, BytesRef indexedBytes)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `FunctionValues`
  `getValues(Map<Object,Object> context, LeafReaderContext readerContext)`
  Gets the values for this reader and the context that was previously passed to createWeight().
  `String`
  `name()`

  ### Methods inherited from class org.apache.lucene.queries.function.valuesource.DocFreqValueSource

  `createWeight, description, equals, hashCode`

  ### Methods inherited from class org.apache.lucene.queries.function.ValueSource

  `asDoubleValuesSource, asLongValuesSource, fromDoubleValuesSource, getSortField, newContext, toString`

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

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

- ## Constructor Details

  - ### TFValueSource

    public TFValueSource(String field, String val, String indexedField, BytesRef indexedBytes)

- ## Method Details

  - ### name

    public String name()
    Overrides:
      `name` in class `TermFreqValueSource`

  - ### getValues

    public FunctionValues getValues(Map<Object,Object> context, LeafReaderContext readerContext) throws IOException
    Description copied from class: `ValueSource`
    Gets the values for this reader and the context that was previously passed to createWeight(). The values must be consumed in a forward docID manner, and you must call this method again to iterate through the values again.
    Overrides:
      `getValues` in class `TermFreqValueSource`
    Throws:
      `IOException`