search_with_filter

API Definition

void search_with_filter(Index::idx_t n, const float *x, Index::idx_t k, float *distances, Index::idx_t *labels, const void *filters) const

Function

Queries the AscendIndexSQ feature vectors and returns IDs of the most similar k features based on the input feature vectors. The CID-based filtering function is provided. filters is a uint32_t array of 6 characters. The first four digits (128 bits) indicate the CID, and the last two digits indicate the left-closed range of the corresponding timestamp, that is, [x,y).

Input

idx_t n: number of feature vectors to be queried.

const float *x: feature vector data.

idx_t k: number of the most similar results to be returned.

const void *filters: filter criteria.

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

  • The value of n cannot be greater than 1e9.
  • The value of k cannot be greater than 1024.
  • The x must be a non-null pointer with a length of dim x n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.
  • The distances and labels must be non-null pointers with a length of k x n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.
  • The filters must be a non-null pointer with a length of 24 bytes. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.