SearchWithFilter (Multi-Filter AscendIndex)
API definition |
void SearchWithFilter(std::vector<AscendIndex *> indexes, idx_t n, const float *x, idx_t k, float *distances, idx_t *labels, void *filters[], bool merged); |
|---|---|
Function |
Performs retrieval of multiple indexes and returns the IDs of the most similar k features based on the input feature vectors. It also provides the CID-based filtering function. filters is a pointer array whose size is n. Each pointer in filters points to a uint32_t array with a length of 6 × indexes.size(). Every six uint32_t arrays form a filter. The first four digits (128 bits) of each filter indicate the corresponding CID, and the last two digits indicate the left-closed range of the corresponding timestamp, that is, [x, y). |
Input |
std::vector<Index *> indexes: multiple indexes to perform retrieval. idx_t n: number of queries for retrieval. const float *x: query vectors for retrieval. idx_t k: number of the most similar results to be returned. void *filters[]: filter criteria. bool merged: whether to merge the retrieval results of multiple indexes. |
Output |
float *distances: distance between a vector and the first k nearest vectors. idx_t *labels: IDs of the first k nearest vectors that are queried. |
Return value |
N/A |
Restrictions |
|