public interface VectorScorerFactory
A factory of quantized vector scorers.
-
Method Summary
Modifier and TypeMethodDescriptionOptional<org.apache.lucene.util.hnsw.RandomVectorScorer> getBFloat16VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector) Returns an optional containing a bfloat16 vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getBFloat16VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values) Returns an optional containing a bfloat16 vector score supplier for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getByteVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.ByteVectorValues values, byte[] queryVector) Returns an optional containing a byte vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getByteVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.ByteVectorValues values) Returns an optional containing a byte vector score supplier for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getFloatVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector) Returns an optional containing a float vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getFloatVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values) Returns an optional containing a float vector score supplier for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt4VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum) Returns an optional containing an int4 packed-nibble query-time vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt4VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values) Returns an optional containing an int4 packed-nibble vector score supplier for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7SQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, float[] queryVector) Returns an optional containing an int7 scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7SQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, float scoreCorrectionConstant) Returns an optional containing an int7 scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7uOSQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] quantizedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum) Returns an optional containing an int7 optimal scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7uOSQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values) Returns an optional containing an int7 optimal scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.static Optional<VectorScorerFactory> instance()
-
Method Details
-
instance
-
getFloatVectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getFloatVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values) Returns an optional containing a float vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd + Float#BYTES) * dimsvalues- the random access vector values- Returns:
- an optional containing the vector scorer supplier, or empty
-
getBFloat16VectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getBFloat16VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.FloatVectorValues values) Returns an optional containing a bfloat16 vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd) * dims * 2values- the random access vector values- Returns:
- an optional containing the vector scorer supplier, or empty
-
getByteVectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getByteVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.index.ByteVectorValues values) Returns an optional containing a byte vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd) * dimsvalues- the random access vector values- Returns:
- an optional containing the vector scorer supplier, or empty
-
getFloatVectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getFloatVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector) Returns an optional containing a float vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity typevalues- the random access vector valuesqueryVector- the query vector- Returns:
- an optional containing the vector scorer, or empty
-
getBFloat16VectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getBFloat16VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.FloatVectorValues values, float[] queryVector) Returns an optional containing a bfloat16 vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity typevalues- the random access vector valuesqueryVector- the query vector- Returns:
- an optional containing the vector scorer, or empty
-
getByteVectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getByteVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.index.ByteVectorValues values, byte[] queryVector) Returns an optional containing a byte vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity typevalues- the random access vector valuesqueryVector- the query vector- Returns:
- an optional containing the vector scorer, or empty
-
getInt7SQVectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7SQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, float scoreCorrectionConstant) Returns an optional containing an int7 scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector data; offset of the first vector is 0, the length must be (maxOrd + Float#BYTES) * dimsvalues- the random access vector valuesscoreCorrectionConstant- the score correction constant- Returns:
- an optional containing the vector scorer supplier, or empty
-
getInt7SQVectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7SQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.util.quantization.QuantizedByteVectorValues values, float[] queryVector) Returns an optional containing an int7 scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity typevalues- the random access vector valuesqueryVector- the query vector- Returns:
- an optional containing the vector scorer, or empty
-
getInt7uOSQVectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt7uOSQVectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values) Returns an optional containing an int7 optimal scalar quantized vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector datavalues- the random access vector values- Returns:
- an optional containing the vector scorer supplier, or empty
-
getInt7uOSQVectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt7uOSQVectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] quantizedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum) Returns an optional containing an int7 optimal scalar quantized vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity typevalues- the random access vector values- Returns:
- an optional containing the vector scorer, or empty
-
getInt4VectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt4VectorScorerSupplier(VectorSimilarityType similarityType, org.apache.lucene.store.IndexInput input, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values) Returns an optional containing an int4 packed-nibble vector score supplier for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
similarityType- the similarity typeinput- the index input containing the vector datavalues- the random access vector values- Returns:
- an optional containing the vector scorer supplier, or empty
-
getInt4VectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt4VectorScorer(org.apache.lucene.index.VectorSimilarityFunction sim, org.apache.lucene.codecs.lucene104.QuantizedByteVectorValues values, byte[] unpackedQuery, float lowerInterval, float upperInterval, float additionalCorrection, int quantizedComponentSum) Returns an optional containing an int4 packed-nibble query-time vector scorer for the given parameters, or an empty optional if a scorer is not supported.- Parameters:
sim- the similarity functionvalues- the quantized vector valuesunpackedQuery- the quantized query bytes (one byte per dimension, 0-15)lowerInterval- query corrective termupperInterval- query corrective termadditionalCorrection- query corrective termquantizedComponentSum- query corrective term- Returns:
- an optional containing the vector scorer, or empty
-