Skip to navigation

CuVS2510GPUVectorsReader

View as Markdown

Java package: com.nvidia.cuvs.lucene

public class CuVS2510GPUVectorsReader extends KnnVectorsReader

KnnVectorsReader instance associated with cuVS format for reading vectors from an index.

Public Members

CuVS2510GPUVectorsReader

public CuVS2510GPUVectorsReader(SegmentReadState state, FlatVectorsReader flatReader) throws IOException

Initializes the CuVS2510GPUVectorsReader, checks and loads the index.

Parameters

NameDescription
stateinstance of the SegmentReadState
flatReaderinstance of the FlatVectorsReader

Throws

TypeDescription
IOExceptionI/O exception

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:99

CuVS2510GPUVectorsReader

CuVS2510GPUVectorsReader( SegmentReadState state, FlatVectorsReader flatReader, FilterBitsetCache filterBitsetCache) throws IOException

Initializes the reader with the cache owned by its vectors format.

Parameters

NameDescription
stateinstance of the SegmentReadState
flatReaderinstance of the FlatVectorsReader
filterBitsetCachefilter cache shared by readers from the same vectors format

Throws

TypeDescription
IOExceptionI/O exception

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:112

readSimilarityFunction

static VectorSimilarityFunction readSimilarityFunction(DataInput input) throws IOException

Checks the distance function validity and returns it.

Parameters

NameDescription
inputinstance of DataInput

Returns

an instance of VectorSimilarityFunction

Throws

TypeDescription
IOException

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:238

readVectorEncoding

static VectorEncoding readVectorEncoding(DataInput input) throws IOException

Reads the vector encoding (The numeric data type of the vector values) from the DataInput.

Parameters

NameDescription
inputinstance of DataInput

Returns

the vector encoding

Throws

TypeDescription
IOException

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:253

getFieldEntry

FieldEntry getFieldEntry(String field)

Gets the FieldEntry for the given field name, or null when this segment holds no cuVS index for it.

Parameters

NameDescription
fieldname of the field

Returns

the meta information for the field, or null

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:316

openCagraIndexForMerge

CagraIndex openCagraIndexForMerge(String field) throws IOException

Deserializes the CAGRA index of a single field onto the GPU, bypassing the GPUIndex cache. This is how CuVS2510GPUVectorsWriter obtains the inputs for the cuVS merge API: a reader opened with Context#MERGE caches no indexes until it is first searched, and a cached index belongs to the com.nvidia.cuvs.CuVSResources of whichever thread opened the reader (or first searched it, for a merge-opened reader), while the merge API requires every input to share one resources instance - the merging thread’s.

The returned index is owned by the caller and must be closed by it.

Parameters

NameDescription
fieldname of the field

Returns

a freshly loaded CAGRA index, or null if this segment has none for the field

Throws

TypeDescription
IOExceptionI/O exception

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:335

lazilyLoadedIndexCount

int lazilyLoadedIndexCount()

Returns the number of indexes a merge-opened reader has loaded so far. Package-private so that tests can check that loading is per field.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:412

close

@Override public void close() throws IOException

Closes the resources.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:453

checkIntegrity

@Override public void checkIntegrity() throws IOException

Checks consistency of this reader.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:483

getFloatVectorValues

@Override public FloatVectorValues getFloatVectorValues(String field) throws IOException

Returns the FloatVectorValues for the given field.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:492

getByteVectorValues

@Override public ByteVectorValues getByteVectorValues(String field)

Returns the ByteVectorValues for the given field.

This is not supported.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:502

@Override public void search(String field, float[] target, KnnCollector knnCollector, Bits acceptDocs) throws IOException

Returns the k nearest neighbor documents using cuVS’s CAGRA or brute force algorithm for this field, to the given vector.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:526

search

@Override public void search(String field, byte[] target, KnnCollector knnCollector, Bits acceptDocs) throws IOException

Return the k nearest neighbor documents as determined by comparison of their vector values for this field, to the given vector.

This is not supported.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:687

readEntry

static FieldEntry readEntry( IndexInput input, VectorEncoding vectorEncoding, VectorSimilarityFunction similarityFunction) throws IOException

Returns an instance of FieldEntry.

Parameters

NameDescription
inputinstance of IndexInput
vectorEncodingThe numeric data type of the vector values
similarityFunctionVector similarity function; used in search to return top K most similar vectors to a target vector

Returns

an instance of FieldEntry

Throws

TypeDescription
IOExceptionI/O Exceptions

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:715

getCagraIndexForField

public CagraIndex getCagraIndexForField(String field) throws IOException

Returns the CagraIndex for the given field, or null if this segment has none (e.g., when the field is missing or the segment only holds a brute force index).

If this reader was opened for a merge and has not been searched on this field yet, this loads the field’s index onto the GPU first. The index is owned by this reader, which closes it, so callers must not close it.

Parameters

NameDescription
fieldthe vector field name

Returns

the CAGRA index, or null

Throws

TypeDescription
IOExceptionI/O exception

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:772

getFilterBitsetCache

FilterBitsetCache getFilterBitsetCache()

Returns the filter cache owned by the vectors format that created this reader.

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:781

getFieldInfos

public FieldInfos getFieldInfos()

Gets the instance of FieldInfos.

Returns

the instance of FieldInfos

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:790

getCuvsIndexes

public IntObjectHashMap<GPUIndex> getCuvsIndexes()

Gets the map of GPUIndex objects.

Returns

the map of GPU index objects, or null if this reader was opened for a merge

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:799

getFieldEntries

public IntObjectHashMap<FieldEntry> getFieldEntries()

Gets the map of FieldEntry objects that hold the meta information for the field.

Returns

the map of FieldEntry objects

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:808

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/CuVS2510GPUVectorsReader.java:62