Class LateInteractionRescorer


public class LateInteractionRescorer extends DoubleValuesSourceRescorer
Rescores top N results from a first pass query using a LateInteractionFloatValuesSource

Typically, you run a low-cost first pass query to collect results from across the index, then use this rescorer to rerank top N hits using multi-vectors, usually from a late interaction model. Multi-vectors should be indexed in the LateInteractionField provided to rescorer.

WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Constructor Details

  • Method Details

    • create

      public static LateInteractionRescorer create(String fieldName, float[][] queryVector)
      Creates a LateInteractionRescorer for provided query vector.
    • create

      public static LateInteractionRescorer create(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction)
      Creates a LateInteractionRescorer for provided query vector.

      Top N results from a first pass query are rescored based on the similarity between queryVector and the multi-vector indexed in fieldName. If document does not have a value indexed in fieldName, a 0f score is assigned.

      Parameters:
      fieldName - the LateInteractionField used for reranking.
      queryVector - query multi-vector to use for similarity comparison
      vectorSimilarityFunction - function used for vector similarity comparisons
    • combine

      protected float combine(float firstPassScore, boolean valuePresent, double sourceValue)
      Description copied from class: DoubleValuesSourceRescorer
      Implement this in a subclass to combine the first pass scores with values from the DoubleValuesSource
      Specified by:
      combine in class DoubleValuesSourceRescorer
      Parameters:
      firstPassScore - Score from firstPassTopDocs
      valuePresent - true if DoubleValuesSource has a value for the hit from first pass
      sourceValue - Value returned from DoubleValuesSource
    • withFallbackToFirstPassScore

      public static LateInteractionRescorer withFallbackToFirstPassScore(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction)
      Creates a LateInteractionRescorer for provided query vector.

      Top N results from a first pass query are rescored based on the similarity between queryVector and the multi-vector indexed in fieldName. Falls back to score from the first pass query if a document does not have a value indexed in fieldName.

      Parameters:
      fieldName - the LateInteractionField used for reranking.
      queryVector - query multi-vector to use for similarity comparison
      vectorSimilarityFunction - function used for vector similarity comparisons.