add

API definition

void add(idx_t n, const float *x) override;

Function

Adds feature vectors to the database.

Input

idx_t n: number of feature vectors to be added.

const float *x: feature vectors to be added.

Output

N/A

Return value

N/A

Restrictions

  • The length of x must be dims × n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown.
  • The total number of vectors (n) is greater than 0 and less than 1e9.
  • The amount of data to be added at a time must be less than or equal to the size of data in the database.
  • add cannot be used together with add_with_ids.
  • After add is used, the labels in the search result may be duplicate. If the service has requirements on labels, you are advised to use add_with_ids.
  • The performance of add is optimized small-batch additions. However, the precision decreases depending on the dataset. It is advised to use small-batch addition primarily for existing databases.