TieredIndexQuery

View as Markdown

Java package: com.nvidia.cuvs

1public class TieredIndexQuery

TieredIndexQuery holds the search parameters and query vectors to be used while invoking search. Currently only supports CAGRA index type.

Thread Safety: Each TieredIndexQuery 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

getIndexType

1public TieredIndexType getIndexType()

Gets the index type for this query.

Returns

the TieredIndexType

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:57

getCagraSearchParameters

1public CagraSearchParams getCagraSearchParameters()

Gets the instance of CagraSearchParams initially set.

Returns

an instance CagraSearchParams

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:66

getQueryVectors

1public float[][] getQueryVectors()

Gets the query vector 2D float array.

Returns

2D float array

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:75

getMapping

1public List<Integer> getMapping()

Gets the passed map instance.

Returns

a map of ID mappings

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:84

getTopK

1public int getTopK()

Gets the topK value.

Returns

the topK value

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:93

getPrefilter

1public BitSet getPrefilter()

Gets the prefilter BitSet.

Returns

a BitSet object representing the prefilter

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:102

getNumDocs

1public long 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/TieredIndexQuery.java:111

getResources

1public CuVSResources getResources()

Gets the CuVSResources instance for this query.

Returns

the CuVSResources instance

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:120

newBuilder

1public static Builder newBuilder(CuVSResources resources)

Creates a new Builder instance.

Parameters

NameDescription
resourcesthe CuVSResources instance to use for this query

Returns

a new Builder instance

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:145

Builder

1public Builder(CuVSResources resources)

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

NameDescription
resourcesthe CuVSResources instance to use for this query (must not be shared between threads)

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:171

withIndexType

1public Builder withIndexType(TieredIndexType indexType)

Sets the index type for this query.

Parameters

NameDescription
indexTypethe index type

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:181

withSearchParams

1public Builder withSearchParams(CagraSearchParams cagraSearchParams)

Sets the instance of configured CagraSearchParams to be passed for search.

Parameters

NameDescription
cagraSearchParamsan instance of the configured CagraSearchParams to be used for this query

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:193

withQueryVectors

1public Builder withQueryVectors(float[][] queryVectors)

Registers the query vectors to be passed in the search call.

Parameters

NameDescription
queryVectors2D float query vector array

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:204

withMapping

1public Builder withMapping(List<Integer> mapping)

Sets the instance of mapping to be used for ID mapping.

Parameters

NameDescription
mappingthe ID mapping instance

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:215

withTopK

1public Builder withTopK(int topK)

Registers the topK value.

Parameters

NameDescription
topKthe topK value used to retrieve the topK results

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:226

withPrefilter

1public Builder withPrefilter(BitSet prefilter, int numDocs)

Sets a BitSet to use as prefilter while searching.

Parameters

NameDescription
prefilterthe BitSet to use as prefilter
numDocsTotal number of dataset vectors; used to align the prefilter correctly

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:239

build

1public TieredIndexQuery build()

Builds an instance of TieredIndexQuery.

Returns

an instance of TieredIndexQuery

Throws

TypeDescription
IllegalStateExceptionif required parameters are missing

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:251

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/TieredIndexQuery.java:23