Package org.apache.lucene.index
Class VectorValues
java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.index.VectorValues
This class provides access to per-document floating point vector values indexed as
KnnVectorField
.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final VectorValues
Represents the lack of vector values.static final int
The maximum length of a vectorFields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the binary encoded vector value for the current document ID.abstract int
Return the dimension of the vectorsabstract int
size()
TODO: should we use cost() for this? We rely on its always being exactly the number of documents having a value for this field, which is not guaranteed by the cost() contract, but in all the implementations so far they are the same.abstract float[]
Return the vector value for the current document ID.Methods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, cost, docID, empty, nextDoc, range, slowAdvance
-
Field Details
-
MAX_DIMENSIONS
public static final int MAX_DIMENSIONSThe maximum length of a vector- See Also:
-
EMPTY
Represents the lack of vector values. It is returned by providers that do not support VectorValues.
-
-
Constructor Details
-
VectorValues
protected VectorValues()Sole constructor
-
-
Method Details
-
dimension
public abstract int dimension()Return the dimension of the vectors -
size
public abstract int size()TODO: should we use cost() for this? We rely on its always being exactly the number of documents having a value for this field, which is not guaranteed by the cost() contract, but in all the implementations so far they are the same.- Returns:
- the number of vectors returned by this iterator
-
vectorValue
Return the vector value for the current document ID. It is illegal to call this method when the iterator is not positioned: before advancing, or after failing to advance. The returned array may be shared across calls, re-used, and modified as the iterator advances.- Returns:
- the vector value
- Throws:
IOException
-
binaryValue
Return the binary encoded vector value for the current document ID. These are the bytes corresponding to the float array return byvectorValue()
. It is illegal to call this method when the iterator is not positioned: before advancing, or after failing to advance. The returned storage may be shared across calls, re-used and modified as the iterator advances.- Returns:
- the binary value
- Throws:
IOException
-