Class OffHeapVectorValues
java.lang.Object
org.apache.lucene.search.DocIdSetIterator
org.apache.lucene.index.VectorValues
org.apache.lucene.codecs.lucene92.OffHeapVectorValues
- All Implemented Interfaces:
RandomAccessVectorValues,RandomAccessVectorValuesProducer
- Direct Known Subclasses:
OffHeapVectorValues.DenseOffHeapVectorValues,OffHeapVectorValues.EmptyOffHeapVectorValues,OffHeapVectorValues.SparseOffHeapVectorValues
abstract class OffHeapVectorValues
extends VectorValues
implements RandomAccessVectorValues, RandomAccessVectorValuesProducer
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 classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final BytesRefprotected final ByteBufferprotected final intprotected final intprotected final intprotected final IndexInputprotected final float[]Fields inherited from class org.apache.lucene.index.VectorValues
EMPTY, MAX_DIMENSIONSFields inherited from class org.apache.lucene.search.DocIdSetIterator
NO_MORE_DOCS -
Constructor Summary
Constructors -
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.longcost()Returns the estimated cost of thisDocIdSetIterator.intReturn the dimension of the vectors(package private) abstract BitsgetAcceptOrds(Bits acceptDocs) (package private) static OffHeapVectorValuesload(Lucene92HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) abstract intordToDoc(int ord) private voidreadValue(int targetOrd) intsize()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, vectorValueMethods inherited from class org.apache.lucene.search.DocIdSetIterator
advance, all, docID, empty, nextDoc, range, slowAdvanceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.index.RandomAccessVectorValuesProducer
randomAccess
-
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)
-
-
Method Details
-
dimension
public int dimension()Description copied from class:VectorValuesReturn the dimension of the vectors- Specified by:
dimensionin interfaceRandomAccessVectorValues- Specified by:
dimensionin classVectorValues
-
size
public int size()Description copied from class:VectorValuesTODO: 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:
sizein interfaceRandomAccessVectorValues- Specified by:
sizein classVectorValues- Returns:
- the number of vectors returned by this iterator
-
cost
public long cost()Description copied from class:DocIdSetIteratorReturns 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:
costin classDocIdSetIterator
-
vectorValue
Description copied from interface:RandomAccessVectorValuesReturn 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:
vectorValuein interfaceRandomAccessVectorValues- Parameters:
targetOrd- a valid ordinal, ≥ 0 and <RandomAccessVectorValues.size().- Throws:
IOException
-
binaryValue
Description copied from interface:RandomAccessVectorValuesReturn 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:
binaryValuein 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(Lucene92HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) throws IOException - Throws:
IOException
-
getAcceptOrds
-