Class OffHeapVectorValues
java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.index.VectorValues
org.apache.lucene.codecs.lucene94.OffHeapVectorValues
- All Implemented Interfaces:
RandomAccessVectorValues
- Direct Known Subclasses:
OffHeapVectorValues.DenseOffHeapVectorValues
,OffHeapVectorValues.EmptyOffHeapVectorValues
,OffHeapVectorValues.SparseOffHeapVectorValues
Read the vector values from the index input. This supports both iterated and random access.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
private static class
private static class
Nested classes/interfaces inherited from class org.apache.lucene.index.VectorValues
VectorValues.SortingVectorValues
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BytesRef
protected final ByteBuffer
protected final int
protected final int
protected final int
protected final IndexInput
protected final float[]
Fields inherited from class org.apache.lucene.index.VectorValues
EMPTY, MAX_DIMENSIONS
Fields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS
-
Constructor Summary
ConstructorsConstructorDescriptionOffHeapVectorValues
(int dimension, int size, IndexInput slice, int byteSize) -
Method Summary
Modifier and TypeMethodDescriptionbinaryValue
(int targetOrd) Return the vector indexed at the given ordinal value as an array of bytes in a BytesRef; these are the bytes corresponding to the float array.long
cost()
Returns the estimated cost of thisDocIdSetIterator
.int
Return the dimension of the vectors(package private) abstract Bits
getAcceptOrds
(Bits acceptDocs) (package private) static OffHeapVectorValues
load
(Lucene94HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) abstract int
ordToDoc
(int ord) private void
readValue
(int targetOrd) 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.float[]
vectorValue
(int targetOrd) Return the vector value indexed at the given ordinal.Methods inherited from class org.apache.lucene.index.VectorValues
binaryValue, vectorValue
Methods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, docID, empty, nextDoc, range, slowAdvance
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.lucene.index.RandomAccessVectorValues
copy
-
Field Details
-
dimension
protected final int dimension -
size
protected final int size -
slice
-
binaryValue
-
byteBuffer
-
byteSize
protected final int byteSize -
value
protected final float[] value
-
-
Constructor Details
-
OffHeapVectorValues
OffHeapVectorValues(int dimension, int size, IndexInput slice, int byteSize)
-
-
Method Details
-
dimension
public int dimension()Description copied from class:VectorValues
Return the dimension of the vectors- Specified by:
dimension
in interfaceRandomAccessVectorValues
- Specified by:
dimension
in classVectorValues
-
size
public int size()Description copied from class:VectorValues
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.- Specified by:
size
in interfaceRandomAccessVectorValues
- Specified by:
size
in classVectorValues
- Returns:
- the number of vectors returned by this iterator
-
cost
public long cost()Description copied from class:DocIdSetIterator
Returns the estimated cost of thisDocIdSetIterator
.This is generally an upper bound of the number of documents this iterator might match, but may be a rough heuristic, hardcoded value, or otherwise completely inaccurate.
- Specified by:
cost
in classDocIdSetIterator
-
vectorValue
Description copied from interface:RandomAccessVectorValues
Return the vector value indexed at the given ordinal. The provided floating point array may be shared and overwritten by subsequent calls to this method andRandomAccessVectorValues.binaryValue(int)
.- Specified by:
vectorValue
in interfaceRandomAccessVectorValues
- Parameters:
targetOrd
- a valid ordinal, ≥ 0 and <RandomAccessVectorValues.size()
.- Throws:
IOException
-
binaryValue
Description copied from interface:RandomAccessVectorValues
Return the vector indexed at the given ordinal value as an array of bytes in a BytesRef; these are the bytes corresponding to the float array. The provided bytes may be shared and overwritten by subsequent calls to this method andRandomAccessVectorValues.vectorValue(int)
.- Specified by:
binaryValue
in interfaceRandomAccessVectorValues
- Parameters:
targetOrd
- a valid ordinal, ≥ 0 and <RandomAccessVectorValues.size()
.- Throws:
IOException
-
readValue
- Throws:
IOException
-
ordToDoc
public abstract int ordToDoc(int ord) -
load
static OffHeapVectorValues load(Lucene94HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) throws IOException - Throws:
IOException
-
getAcceptOrds
-