add_with_ids
API definition |
void add_with_ids(idx_t n, const uint8_t *x, const idx_t *xids) override; |
|---|---|
Function |
Adds feature vectors to the database and specifies the corresponding IDs. |
Input |
idx_t n: number of feature vectors to be added. const uint8_t *x: feature vectors to be added. const idx_t *xids: IDs of the feature vectors to be added. |
Output |
N/A |
Return value |
N/A |
Restrictions |
For the add operation, ensure that the final database size (n) is the smaller value between the actual memory capacity of the chip and 1e9. However, n should be greater than 0. The length of x must be dims/8 × n, and the length of xids must be n. Otherwise, an out-of-bounds read/write error may occur, causing program breakdown. You need to ensure the validity of xids based on your service scenario. For example, if duplicate IDs exist in the database, label in the retrieval result cannot correspond to specific vectors. |