Module org.apache.lucene.core
Package org.apache.lucene.codecs.hnsw
Class ScalarQuantizedVectorScorer
- java.lang.Object
-
- org.apache.lucene.codecs.hnsw.ScalarQuantizedVectorScorer
-
- All Implemented Interfaces:
FlatVectorsScorer
public class ScalarQuantizedVectorScorer extends java.lang.Object implements FlatVectorsScorer
Default scalar quantized implementation ofFlatVectorsScorer
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScalarQuantizedVectorScorer.ScalarQuantizedRandomVectorScorerSupplier
Quantized vector scorer supplier
-
Field Summary
Fields Modifier and Type Field Description private FlatVectorsScorer
nonQuantizedDelegate
-
Constructor Summary
Constructors Constructor Description ScalarQuantizedVectorScorer(FlatVectorsScorer flatVectorsScorer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RandomVectorScorer
getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, byte[] target)
Returns aRandomVectorScorer
for the given set of vectors and target vector.RandomVectorScorer
getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, float[] target)
Returns aRandomVectorScorer
for the given set of vectors and target vector.RandomVectorScorerSupplier
getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues)
Returns aRandomVectorScorerSupplier
that can be used to score vectorsstatic float
quantizeQuery(float[] query, byte[] quantizedQuery, VectorSimilarityFunction similarityFunction, ScalarQuantizer scalarQuantizer)
java.lang.String
toString()
-
-
-
Field Detail
-
nonQuantizedDelegate
private final FlatVectorsScorer nonQuantizedDelegate
-
-
Constructor Detail
-
ScalarQuantizedVectorScorer
public ScalarQuantizedVectorScorer(FlatVectorsScorer flatVectorsScorer)
-
-
Method Detail
-
quantizeQuery
public static float quantizeQuery(float[] query, byte[] quantizedQuery, VectorSimilarityFunction similarityFunction, ScalarQuantizer scalarQuantizer)
-
getRandomVectorScorerSupplier
public RandomVectorScorerSupplier getRandomVectorScorerSupplier(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorerSupplier
that can be used to score vectors- Specified by:
getRandomVectorScorerSupplier
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to score- Returns:
- a
RandomVectorScorerSupplier
that can be used to score vectors - Throws:
java.io.IOException
- if an I/O error occurs
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, float[] target) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorer
for the given set of vectors and target vector.- Specified by:
getRandomVectorScorer
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to scoretarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
getRandomVectorScorer
public RandomVectorScorer getRandomVectorScorer(VectorSimilarityFunction similarityFunction, RandomAccessVectorValues vectorValues, byte[] target) throws java.io.IOException
Description copied from interface:FlatVectorsScorer
Returns aRandomVectorScorer
for the given set of vectors and target vector.- Specified by:
getRandomVectorScorer
in interfaceFlatVectorsScorer
- Parameters:
similarityFunction
- the similarity function to usevectorValues
- the vector values to scoretarget
- the target vector- Returns:
- a
RandomVectorScorer
for the given field and target vector. - Throws:
java.io.IOException
- if an I/O error occurs when reading from the index.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-