java.lang.Object
org.apache.lucene.search.DoubleValuesSource
org.apache.lucene.search.VectorSimilarityValuesSource
- All Implemented Interfaces:
SegmentCacheable
- Direct Known Subclasses:
ByteVectorSimilarityValuesSource,FloatVectorSimilarityValuesSource
An abstract class that provides the vector similarity scores between the query vector and the
KnnFloatVectorField or KnnByteVectorField for documents.-
Field Summary
FieldsFields inherited from class org.apache.lucene.search.DoubleValuesSource
SCORES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract VectorScorergetValues(LeafReaderContext ctx, DoubleValues scores) Returns aDoubleValuesinstance for the passed-in LeafReaderContext and scoresbooleanbooleanReturn true if document scores are needed to calculate valuesrewrite(IndexSearcher reader) Return a DoubleValuesSource specialised for the given IndexSearcherMethods inherited from class org.apache.lucene.search.DoubleValuesSource
constant, equals, explain, fromDoubleField, fromField, fromFloatField, fromIntField, fromLongField, fromQuery, fromScorer, getSortField, hashCode, similarityToQueryVector, similarityToQueryVector, toLongValuesSource, toString
-
Field Details
-
fieldName
-
-
Constructor Details
-
VectorSimilarityValuesSource
-
-
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
-
getScorer
- 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
-
isCacheable
- Returns:
trueif the object can be cached against a given leaf
-