Package org.apache.lucene.util.hnsw
Interface RandomVectorScorer
-
public interface RandomVectorScorer
ARandomVectorScorer
for 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 RandomVectorScorer
createBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction, byte[] query)
Creates a default scorer for byte vectors.static RandomVectorScorer
createFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction, float[] query)
Creates a default scorer for float vectors.float
score(int node)
Returns the score between the query and the provided node.
-
-
-
Method Detail
-
score
float score(int node) throws IOException
Returns 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
RandomAccessVectorValues
given 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
RandomAccessVectorValues
given 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
-
-