Package org.apache.lucene.search
Class LateInteractionRescorer
java.lang.Object
org.apache.lucene.search.Rescorer
org.apache.lucene.search.DoubleValuesSourceRescorer
org.apache.lucene.search.LateInteractionRescorer
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected floatcombine(float firstPassScore, boolean valuePresent, double sourceValue) Implement this in a subclass to combine the first pass scores with values from the DoubleValuesSourcestatic LateInteractionRescorerCreates a LateInteractionRescorer for provided query vector.static LateInteractionRescorercreate(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction) Creates a LateInteractionRescorer for provided query vector.static LateInteractionRescorerwithFallbackToFirstPassScore(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction) Creates a LateInteractionRescorer for provided query vector.Methods inherited from class org.apache.lucene.search.DoubleValuesSourceRescorer
explain, rescore
-
Constructor Details
-
LateInteractionRescorer
-
-
Method Details
-
create
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
queryVectorand the multi-vector indexed infieldName. If document does not have a value indexed infieldName, a 0f score is assigned.- Parameters:
fieldName- theLateInteractionFieldused for reranking.queryVector- query multi-vector to use for similarity comparisonvectorSimilarityFunction- function used for vector similarity comparisons
-
combine
protected float combine(float firstPassScore, boolean valuePresent, double sourceValue) Description copied from class:DoubleValuesSourceRescorerImplement this in a subclass to combine the first pass scores with values from the DoubleValuesSource- Specified by:
combinein classDoubleValuesSourceRescorer- Parameters:
firstPassScore- Score from firstPassTopDocsvaluePresent- true if DoubleValuesSource has a value for the hit from first passsourceValue- 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
queryVectorand the multi-vector indexed infieldName. Falls back to score from the first pass query if a document does not have a value indexed infieldName.- Parameters:
fieldName- theLateInteractionFieldused for reranking.queryVector- query multi-vector to use for similarity comparisonvectorSimilarityFunction- function used for vector similarity comparisons.
-