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 Classes Modifier and Type Class Description (package private) static classOffHeapVectorValues.DenseOffHeapVectorValuesprivate static classOffHeapVectorValues.EmptyOffHeapVectorValuesprivate static classOffHeapVectorValues.SparseOffHeapVectorValues
-
Field Summary
Fields Modifier and Type Field Description protected BytesRefbinaryValueprotected java.nio.ByteBufferbyteBufferprotected intbyteSizeprotected intdimensionprotected intsizeprotected IndexInputsliceprotected float[]value-
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
Constructors Constructor Description OffHeapVectorValues(int dimension, int size, IndexInput slice)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description BytesRefbinaryValue(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.intdimension()Return 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, 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.RandomAccessVectorValuesProducer
randomAccess
-
-
-
-
Field Detail
-
dimension
protected final int dimension
-
size
protected final int size
-
slice
protected final IndexInput slice
-
binaryValue
protected final BytesRef binaryValue
-
byteBuffer
protected final java.nio.ByteBuffer byteBuffer
-
byteSize
protected final int byteSize
-
value
protected final float[] value
-
-
Constructor Detail
-
OffHeapVectorValues
OffHeapVectorValues(int dimension, int size, IndexInput slice)
-
-
Method Detail
-
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
public float[] vectorValue(int targetOrd) throws java.io.IOExceptionDescription 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:
java.io.IOException
-
binaryValue
public BytesRef binaryValue(int targetOrd) throws java.io.IOException
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:
java.io.IOException
-
readValue
private void readValue(int targetOrd) throws java.io.IOException- Throws:
java.io.IOException
-
ordToDoc
public abstract int ordToDoc(int ord)
-
load
static OffHeapVectorValues load(Lucene92HnswVectorsReader.FieldEntry fieldEntry, IndexInput vectorData) throws java.io.IOException
- Throws:
java.io.IOException
-
-