Package org.apache.lucene.search
Class VectorScorer
java.lang.Object
org.apache.lucene.search.VectorScorer
- Direct Known Subclasses:
VectorScorer.ByteVectorScorer
,VectorScorer.FloatVectorScorer
Computes the similarity score between a given query vector and different document vectors. This
is primarily used by
KnnVectorQuery
to run an exact, exhaustive
search over the vectors.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VectorSimilarityFunction
protected final VectorValues
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
advanceExact
(int doc) Advance the instance to the given document ID and return true if there is a value for that document.(package private) static VectorScorer
create
(LeafReaderContext context, FieldInfo fi, float[] query) Create a new vector scorer instance.(package private) abstract float
score()
Compute the similarity score for the current document.
-
Field Details
-
values
-
similarity
-
-
Constructor Details
-
VectorScorer
VectorScorer(VectorValues values, VectorSimilarityFunction similarity)
-
-
Method Details
-
create
static VectorScorer create(LeafReaderContext context, FieldInfo fi, float[] query) throws IOException Create a new vector scorer instance.- Parameters:
context
- the reader contextfi
- the FieldInfo for the field containing document vectorsquery
- the query vector to compute the similarity for- Throws:
IOException
-
advanceExact
Advance the instance to the given document ID and return true if there is a value for that document.- Throws:
IOException
-
score
Compute the similarity score for the current document.- Throws:
IOException
-