Package org.apache.lucene.index
Class FloatVectorValues
java.lang.Object
org.apache.lucene.index.KnnVectorValues
org.apache.lucene.index.FloatVectorValues
- Direct Known Subclasses:
OffHeapFloatVectorValues
This class provides access to per-document floating point vector values indexed as
KnnFloatVectorField
.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.lucene.index.KnnVectorValues
KnnVectorValues.DocIndexIterator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
checkField
(LeafReader in, String field) Checks the Vector Encoding of a fieldabstract FloatVectorValues
copy()
Creates a new copy of thisKnnVectorValues
.static FloatVectorValues
fromFloats
(List<float[]> vectors, int dim) Creates aFloatVectorValues
from a list of float arrays.The vector encoding of these values.scorer
(float[] target) Return aVectorScorer
for the given query vector and the currentFloatVectorValues
.abstract float[]
vectorValue
(int ord) Return the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown.Methods inherited from class org.apache.lucene.index.KnnVectorValues
createDenseIterator, createSparseIterator, dimension, fromDISI, getAcceptOrds, getVectorByteLength, iterator, ordToDoc, size
-
Constructor Details
-
FloatVectorValues
protected FloatVectorValues()Sole constructor
-
-
Method Details
-
vectorValue
Return the vector value for the given vector ordinal which must be in [0, size() - 1], otherwise IndexOutOfBoundsException is thrown. The returned array may be shared across calls.- Returns:
- the vector value
- Throws:
IOException
-
copy
Description copied from class:KnnVectorValues
Creates a new copy of thisKnnVectorValues
. This is helpful when you need to access different values at once, to avoid overwriting the underlying vector returned.- Specified by:
copy
in classKnnVectorValues
- Throws:
IOException
-
checkField
Checks the Vector Encoding of a field- Throws:
IllegalStateException
- iffield
has vectors, but using a different encoding- WARNING: This API is experimental and might change in incompatible ways in the next release.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
scorer
Return aVectorScorer
for the given query vector and the currentFloatVectorValues
.- Parameters:
target
- the query vector- Returns:
- a
VectorScorer
instance or null - Throws:
IOException
-
getEncoding
Description copied from class:KnnVectorValues
The vector encoding of these values.- Specified by:
getEncoding
in classKnnVectorValues
-
fromFloats
Creates aFloatVectorValues
from a list of float arrays.- Parameters:
vectors
- the list of float arraysdim
- the dimension of the vectors- Returns:
- a
FloatVectorValues
instance
-