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 classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final VectorSimilarityFunctionprotected final VectorValues -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadvanceExact(int doc) Advance the instance to the given document ID and return true if there is a value for that document.(package private) static VectorScorercreate(LeafReaderContext context, FieldInfo fi, float[] query) Create a new vector scorer instance.(package private) abstract floatscore()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
-