Module org.apache.lucene.core
Package org.apache.lucene.util.hnsw
Interface RandomVectorScorerSupplier
- All Known Subinterfaces:
CloseableRandomVectorScorerSupplier
- All Known Implementing Classes:
Lucene99FlatVectorsWriter.FlatCloseableRandomVectorScorerSupplier,Lucene99ScalarQuantizedVectorsWriter.ScalarQuantizedCloseableRandomVectorScorerSupplier,RandomVectorScorerSupplier.ByteScoringSupplier,RandomVectorScorerSupplier.FloatScoringSupplier,ScalarQuantizedRandomVectorScorerSupplier
public interface RandomVectorScorerSupplier
A supplier that creates
RandomVectorScorer from an ordinal.-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classRandomVectorScorerSupplier for bytes vectorstatic final classRandomVectorScorerSupplier for Float vector -
Method Summary
Modifier and TypeMethodDescriptioncopy()Make a copy of the supplier, which will copy the underlying vectorValues so the copy is safe to be used in other threads.static RandomVectorScorerSuppliercreateBytes(RandomAccessVectorValues<byte[]> vectors, VectorSimilarityFunction similarityFunction) Creates aRandomVectorScorerSupplierto compare byte vectors.static RandomVectorScorerSuppliercreateFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction) Creates aRandomVectorScorerSupplierto compare float vectors.scorer(int ord) This creates aRandomVectorScorerfor scoring random nodes in batches against the given ordinal.
-
Method Details
-
scorer
This creates aRandomVectorScorerfor scoring random nodes in batches against the given ordinal.- Parameters:
ord- the ordinal of the node to compare- Returns:
- a new
RandomVectorScorer - Throws:
IOException
-
copy
Make a copy of the supplier, which will copy the underlying vectorValues so the copy is safe to be used in other threads.- Throws:
IOException
-
createFloats
static RandomVectorScorerSupplier createFloats(RandomAccessVectorValues<float[]> vectors, VectorSimilarityFunction similarityFunction) throws IOException Creates aRandomVectorScorerSupplierto compare float vectors. The vectorValues passed in will be copied and the original copy will not be used.- 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 aRandomVectorScorerSupplierto compare byte vectors. The vectorValues passed in will be copied and the original copy will not be used.- Parameters:
vectors- the underlying storage for vectorssimilarityFunction- the similarity function to score vectors- Throws:
IOException
-