AddWithIds

API definition

APP_ERROR AddWithIds (const std::vector<float>& baseRawData, const std::vector<int64_t>& ids);

Function

Adds new feature vectors to the AscendIndexGreat database. When this API is used to add a feature, its ID is in the range of [0, ntotal).

Input

  • const std::vector<float>& baseRawData: feature vectors to be added.
  • const std::vector<int64_t>& ids: IDs of feature vectors to be added. The ID must be unique in the Index instance.

Output

N/A

Return value

APP_ERROR: return status. For details, see Return Code Reference.

Restrictions

  • The length of the array baseRawData must be dim × nTotal. nTotal indicates the number of vectors to be added, and dim indicates the dimension of each vector.
  • Value range of nTotal: 10000 ≤ nTotal ≤ 1e8.
  • The length of ids must be nTotal. You need to ensure the validity of ids based on the service scenario. For example, if duplicate IDs exist in the database, label in the search result cannot correspond to specific vectors in the database.
  • This API can be called only once to add vectors to the database. This API cannot be used together with Add.