public interface VectorScorerFactory
-
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> getFloat32VectorScorer(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> getFloat32VectorScorerSupplier(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.util.quantization.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.util.quantization.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.LegacyQuantizedByteVectorValues 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.LegacyQuantizedByteVectorValues 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.util.quantization.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.util.quantization.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.Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt8VectorScorer(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> getInt8VectorScorerSupplier(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.newES91OSQVectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) Create a newES91OSQVectorsScorerfor the givenIndexInput.newES92Int7VectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) Create a newES92Int7VectorsScorerfor the givenIndexInput.newES93BinaryQuantizedVectorScorer(org.apache.lucene.store.IndexInput input, int dimensions, int vectorLengthInBytes) newES940OSQVectorsScorer(org.apache.lucene.store.IndexInput input, byte queryBits, byte indexBits, int dimension, int dataLength, int bulkSize, ES940OSQVectorsScorer.BitEncoding bitEncoding) Create a newES940OSQVectorsScorerfor the givenIndexInputand explicit packed-vs-striped disk layout.org.apache.lucene.codecs.hnsw.FlatVectorsScorerCreate a newFlatVectorsScorerfor scoring arbitrary flat vectors.booleantrueif this factory uses native code anywhere.
-
Method Details
-
usesNative
boolean usesNative()trueif this factory uses native code anywhere. -
newES91OSQVectorsScorer
ES91OSQVectorsScorer newES91OSQVectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) throws IOException Create a newES91OSQVectorsScorerfor the givenIndexInput.- Throws:
IOException
-
newES940OSQVectorsScorer
ES940OSQVectorsScorer newES940OSQVectorsScorer(org.apache.lucene.store.IndexInput input, byte queryBits, byte indexBits, int dimension, int dataLength, int bulkSize, ES940OSQVectorsScorer.BitEncoding bitEncoding) throws IOException Create a newES940OSQVectorsScorerfor the givenIndexInputand explicit packed-vs-striped disk layout. The input should be unwrapped before calling this method. If the input is still aFilterIndexInputthat does not implementMemorySegmentAccessInputorDirectAccessInput, anIllegalArgumentExceptionis thrown. Non-wrapper inputs (e.g.ByteBuffersIndexInput) are accepted and use a heap-copy fallback.- Throws:
IOException
-
newES92Int7VectorsScorer
ES92Int7VectorsScorer newES92Int7VectorsScorer(org.apache.lucene.store.IndexInput input, int dimension, int bulkSize) throws IOException Create a newES92Int7VectorsScorerfor the givenIndexInput. SeenewES940OSQVectorsScorer(org.apache.lucene.store.IndexInput, byte, byte, int, int, int, org.elasticsearch.simdvec.ES940OSQVectorsScorer.BitEncoding)for input type requirements.- Throws:
IOException
-
newES93BinaryQuantizedVectorScorer
ES93BinaryQuantizedVectorScorer newES93BinaryQuantizedVectorScorer(org.apache.lucene.store.IndexInput input, int dimensions, int vectorLengthInBytes) throws IOException - Throws:
IOException
-
newFlatVectorsScorer
org.apache.lucene.codecs.hnsw.FlatVectorsScorer newFlatVectorsScorer()Create a newFlatVectorsScorerfor scoring arbitrary flat vectors. -
getFloat32VectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getFloat32VectorScorerSupplier(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
-
getInt8VectorScorerSupplier
Optional<org.apache.lucene.util.hnsw.RandomVectorScorerSupplier> getInt8VectorScorerSupplier(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
-
getFloat32VectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getFloat32VectorScorer(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
-
getInt8VectorScorer
Optional<org.apache.lucene.util.hnsw.RandomVectorScorer> getInt8VectorScorer(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.LegacyQuantizedByteVectorValues 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.LegacyQuantizedByteVectorValues 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.util.quantization.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.util.quantization.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.util.quantization.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.util.quantization.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
-