Package org.apache.lucene.util.hnsw
Interface RandomVectorScorer
- All Known Subinterfaces:
UpdateableRandomVectorScorer
- All Known Implementing Classes:
RandomVectorScorer.AbstractRandomVectorScorer,UpdateableRandomVectorScorer.AbstractUpdateableRandomVectorScorer
public interface RandomVectorScorer
A
RandomVectorScorer for scoring random nodes in batches against an abstract query. This
class isn't thread-safe and should be used by a single thread.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classCreates a default scorer for random access vectors. -
Method Summary
Modifier and TypeMethodDescriptiondefault voidbulkScore(int[] nodes, float[] scores, int numNodes) Score a list of numNodes and store the results in the scores array.default BitsgetAcceptOrds(Bits acceptDocs) Returns theBitsrepresenting live documents.intmaxOrd()default intordToDoc(int ord) Translates vector ordinal to the correct document ID.floatscore(int node) Returns the score between the query and the provided node.
-
Method Details
-
score
Returns the score between the query and the provided node.- Parameters:
node- a random node in the graph- Returns:
- the computed score
- Throws:
IOException
-
bulkScore
Score a list of numNodes and store the results in the scores array.This may be more efficient than calling
score(int)for each node.- Parameters:
nodes- array of nodes to score.scores- output array of scores corresponding to each node.numNodes- number of nodes to score. Must not exceed length of nodes or scores arrays.- Throws:
IOException
-
maxOrd
int maxOrd()- Returns:
- the maximum possible ordinal for this scorer
-
ordToDoc
default int ordToDoc(int ord) Translates vector ordinal to the correct document ID. By default, this is an identity function.- Parameters:
ord- the vector ordinal- Returns:
- the document Id for that vector ordinal
-
getAcceptOrds
Returns theBitsrepresenting live documents. By default, this is an identity function.- Parameters:
acceptDocs- the accept docs- Returns:
- the accept docs
-