DoubleValuesSourceRescorer (Lucene 10.5.0 core API)
Description: declaration: package: org.apache.lucene.search, class: DoubleValuesSourceRescorer

Package org.apache.lucene.search

# Class DoubleValuesSourceRescorer

java.lang.Object
org.apache.lucene.search.Rescorer
org.apache.lucene.search.DoubleValuesSourceRescorer

Direct Known Subclasses:
  `LateInteractionRescorer`

public abstract class DoubleValuesSourceRescorer extends Rescorer
A `Rescorer` that uses provided DoubleValuesSource to rescore first pass hits.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DoubleValuesSourceRescorer(DoubleValuesSource valuesSource)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected abstract float`
  `combine(float firstPassScore, boolean valuePresent, double sourceValue)`
  Implement this in a subclass to combine the first pass scores with values from the DoubleValuesSource
  `Explanation`
  `explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID)`
  Explains how the score for the specified document was computed.
  `TopDocs`
  `rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN)`
  Rescore an initial first-pass `TopDocs`.

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

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

- ## Constructor Details

  - ### DoubleValuesSourceRescorer

    public DoubleValuesSourceRescorer(DoubleValuesSource valuesSource)

- ## Method Details

  - ### combine

    protected abstract float combine(float firstPassScore, boolean valuePresent, double sourceValue)
    Implement this in a subclass to combine the first pass scores with values from the DoubleValuesSource
    Parameters:
      `firstPassScore` - Score from firstPassTopDocs
      `valuePresent` - true if DoubleValuesSource has a value for the hit from first pass
      `sourceValue` - Value returned from DoubleValuesSource

  - ### rescore

    public TopDocs rescore(IndexSearcher searcher, TopDocs firstPassTopDocs, int topN) throws IOException
    Description copied from class: `Rescorer`
    Rescore an initial first-pass `TopDocs`.
    Specified by:
      `rescore` in class `Rescorer`
    Parameters:
      `searcher` - `IndexSearcher` used to produce the first pass topDocs
      `firstPassTopDocs` - Hits from the first pass search. It's very important that these hits were produced by the provided searcher; otherwise the doc IDs will not match!
      `topN` - How many re-scored hits to return
    Throws:
      `IOException`

  - ### explain

    public Explanation explain(IndexSearcher searcher, Explanation firstPassExplanation, int docID) throws IOException
    Description copied from class: `Rescorer`
    Explains how the score for the specified document was computed.
    Specified by:
      `explain` in class `Rescorer`
    Throws:
      `IOException`