AddWithIds

API definition

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

Function

Creates an AscendIndexVStar database and adds new feature vectors into the database. Also, it allows users to specify vector IDs to be added.

Input

const std::vector<float>& baseData: feature vectors to be added.

const std::vector<int64_t>& ids: mapping of vector IDs.

Output

N/A

Return value

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

Restrictions

  • The length of baseData must be n × dim, where n indicates the number of vectors to be added, and dim indicates vector dimension.
  • The length of ids must be n. 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.
  • n ∈ [10000, 1e8].