我要评分
获取效率
正确性
完整性
易理解

SearchBatchedParallel

API Definition

1. Status ScannInterface::SearchBatchedParallel(const DenseDataset<float>& queries, MutableSpan<NNResultsVector> res, int final_nn, int pre_reorder_nn, int leaves, int batch_size) const;

2. Status ScannInterface::SearchBatchedParallel(const DenseDataset<float>& queries, const std::vector<int64_t>& indices, MutableSpan<NNResultsVector> res, int final_nn, int pre_reorder_nn, int leaves, int batch_size) const;

Function

  1. Parallel batch query search (multi-thread behavior consistent with the open source algorithm).
  2. An overload of the parallel batch query search function, including a list of indices for component filtering (KScaNN-specific API).

Parameters

Parameter

Data Type

Description

Value Range

queries

const DatapointPtr<float>&

Queries in a batch.

The value cannot be null.

res

MutableSpan<NNResultsVector>

Stores final results (labels and distances) with length final_nn for each entry representing the number of returned results.

The value cannot be null. The length is the number of query vectors.

final_nn

int

Number of returned results.

≥ 1. The value must match the build parameters.

pre_reorder_nn

int

Number of results saved before reordering.

final_nn, where final_nn indicates the number of results returned.

leaves

int

Number of subspaces to be searched.

[1, n_leaves], where n_leaves indicates the total number of subspaces in the IVF index partition.

indices

const std::vector<int64_t>&

Indices of the elements used for filtering.

The value cannot be null.

batch_size

int

Size of the search batch.

[1, MAXINT]. The default value is 256.

Return Value

Data Type

Description

Status

Execution status of the method. You can determine whether the method is successfully executed by calling status.ok().