Package org.apache.lucene.util.hnsw
Interface RandomVectorScorerSupplier
-
public interface RandomVectorScorerSupplier
A supplier that createsRandomVectorScorer
from an ordinal.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static RandomVectorScorerSupplier
createBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction)
Creates aRandomVectorScorerSupplier
to compare byte vectors.static RandomVectorScorerSupplier
createFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction)
Creates aRandomVectorScorerSupplier
to compare float vectors.RandomVectorScorer
scorer(int ord)
This creates aRandomVectorScorer
for scoring random nodes in batches against the given ordinal.
-
-
-
Method Detail
-
scorer
RandomVectorScorer scorer(int ord) throws IOException
This creates aRandomVectorScorer
for scoring random nodes in batches against the given ordinal.- Parameters:
ord
- the ordinal of the node to compare- Returns:
- a new
RandomVectorScorer
- Throws:
IOException
-
createFloats
static RandomVectorScorerSupplier createFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction) throws IOException
Creates aRandomVectorScorerSupplier
to compare 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 vectors- Throws:
IOException
-
createBytes
static RandomVectorScorerSupplier createBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction) throws IOException
Creates aRandomVectorScorerSupplier
to compare 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 score vectors- Throws:
IOException
-
-