Class LateInteractionFloatValuesSource
- All Implemented Interfaces:
SegmentCacheable
DoubleValuesSource that scores documents using similarity between a multi-vector query,
and indexed document multi-vectors.
This is useful re-ranking query results using late interaction models, where documents and
queries are represented as multi-vectors of composing token vectors. Document vectors are indexed
using LateInteractionField.
- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the function to compute similarity score between query and document multi-vectors -
Field Summary
Fields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES -
Constructor Summary
ConstructorsConstructorDescriptionLateInteractionFloatValuesSource(String fieldName, float[][] queryVector) LateInteractionFloatValuesSource(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction) LateInteractionFloatValuesSource(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction, MultiVectorSimilarity scoreFunction) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetValues(LeafReaderContext ctx, DoubleValues scores) Returns aDoubleValuesinstance for the passed-in LeafReaderContext and scoresinthashCode()booleanbooleanReturn true if document scores are needed to calculate valuesrewrite(IndexSearcher reader) Return a DoubleValuesSource specialised for the given IndexSearchertoString()Methods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, similarityToQueryVector, similarityToQueryVector, toLongValuesSource, toSortableLongDoubleValuesSource
-
Constructor Details
-
LateInteractionFloatValuesSource
-
LateInteractionFloatValuesSource
public LateInteractionFloatValuesSource(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction) -
LateInteractionFloatValuesSource
public LateInteractionFloatValuesSource(String fieldName, float[][] queryVector, VectorSimilarityFunction vectorSimilarityFunction, MultiVectorSimilarity scoreFunction)
-
-
Method Details
-
getValues
Description copied from class:DoubleValuesSourceReturns aDoubleValuesinstance for the passed-in LeafReaderContext and scoresIf scores are not needed to calculate the values (ie
returns false, callers may safely passnullfor thescoresparameter.- Specified by:
getValuesin classDoubleValuesSource- Throws:
IOException
-
needsScores
public boolean needsScores()Description copied from class:DoubleValuesSourceReturn true if document scores are needed to calculate values- Specified by:
needsScoresin classDoubleValuesSource
-
rewrite
Description copied from class:DoubleValuesSourceReturn a DoubleValuesSource specialised for the given IndexSearcherImplementations should assume that this will only be called once. IndexReader-independent implementations can just return
thisQueries that use DoubleValuesSource objects should call rewrite() during
Query.createWeight(IndexSearcher, ScoreMode, float)rather than duringQuery.rewrite(IndexSearcher)to avoid IndexReader reference leakage.For the same reason, implementations that cache references to the IndexSearcher should return a new object from this method.
- Specified by:
rewritein classDoubleValuesSource- Throws:
IOException
-
hashCode
public int hashCode()- Specified by:
hashCodein classDoubleValuesSource
-
equals
- Specified by:
equalsin classDoubleValuesSource
-
toString
- Specified by:
toStringin classDoubleValuesSource
-
isCacheable
- Returns:
trueif the object can be cached against a given leaf
-