Package org.apache.lucene.util.hnsw
Interface RandomVectorScorer
-
public interface RandomVectorScorerARandomVectorScorerfor scoring random nodes in batches against an abstract query.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RandomVectorScorercreateBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction, byte[] query)Creates a default scorer for byte vectors.static RandomVectorScorercreateFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction, float[] query)Creates a default scorer for float vectors.floatscore(int node)Returns the score between the query and the provided node.
-
-
-
Method Detail
-
score
float score(int node) throws IOExceptionReturns the score between the query and the provided node.- Parameters:
node- a random node in the graph- Returns:
- the computed score
- Throws:
IOException
-
createFloats
static RandomVectorScorer createFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction, float[] query)
Creates a default scorer for float vectors.WARNING: The
RandomAccessVectorValuesgiven can contain stateful buffers. Avoid using it after calling this function. If you plan to use it again outside the returnedRandomVectorScorer, think about passing a copied version (RandomAccessVectorValues.copy()).- Parameters:
vectors- the underlying storage for vectorssimilarityFunction- the similarity function to score vectorsquery- the actual query
-
createBytes
static RandomVectorScorer createBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction, byte[] query)
Creates a default scorer for byte vectors.WARNING: The
RandomAccessVectorValuesgiven can contain stateful buffers. Avoid using it after calling this function. If you plan to use it again outside the returnedRandomVectorScorer, think about passing a copied version (RandomAccessVectorValues.copy()).- Parameters:
vectors- the underlying storage for vectorssimilarityFunction- the similarity function to use to score vectorsquery- the actual query
-
-