CagraQuery
Java package: com.nvidia.cuvs
CagraQuery holds the CagraSearchParams and the query vectors to be used while invoking search.
Thread Safety: Each CagraQuery instance should use its own CuVSResources object that is not shared with other threads. Sharing CuVSResources between threads can lead to memory allocation errors or JVM crashes.
Public Members
CagraQuery
Constructs an instance of CagraQuery using cagraSearchParameters,
preFilter, queryVectors, mapping, and topK.
Parameters
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:43
getCagraSearchParameters
Gets the instance of CagraSearchParams initially set.
Returns
an instance CagraSearchParams
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:66
getQueryVectors
Gets the query vector matrix.
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:73
getMapping
Gets the function mapping ordinals (neighbor IDs) to custom user IDs
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:80
getTopK
Gets the topK value.
Returns
the topK value
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:89
getPrefilter
Gets the prefilter BitSet.
Returns
a BitSet object representing the prefilter
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:98
getNumDocs
Gets the number of documents in this index, as used for prefilter
Returns
number of documents as an integer
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:107
getResources
Gets the CuVSResources instance for this query.
Returns
the CuVSResources instance
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:116
Builder
Constructor that requires CuVSResources.
Important: The provided CuVSResources instance should not be shared with other threads. Each thread performing searches should create its own CuVSResources instance to avoid memory allocation conflicts and potential JVM crashes.
Parameters
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:155
withSearchParams
Sets the instance of configured CagraSearchParams to be passed for search.
Parameters
Returns
an instance of this Builder
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:166
withQueryVectors
Registers the query vectors to be passed in the search call.
Parameters
Returns
an instance of this Builder
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:177
withMapping
Sets the function used to map ordinals (neighbor IDs) to custom user IDs
Parameters
Returns
an instance of this Builder
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:188
withTopK
Registers the topK value.
Parameters
Returns
an instance of this Builder
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:199
withPrefilter
Sets a global prefilter for all queries in this CagraQuery.
The prefilter array must contain exactly one BitSet,
which is applied to all queries. A bit value of 1 includes the
corresponding dataset vector; 0 excludes it.
Parameters
Returns
this Builder instance
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:214
build
Builds an instance of CuVSQuery.
Returns
an instance of CuVSQuery
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:225
Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraQuery.java:21