下载
中文
注册

AddWithIds

API定义

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

功能描述

向AscendIndexGreat底库中添加新的特征向量。使用AddWithIds接口添加特征,对应特征的默认ids为[0, ntotal)。

输入

  • const std::vector<float>& baseRawData:添加进底库的特征向量。
  • const std::vector<int64_t>& ids:添加进底库的特征向量ID。ID在Index实例中需唯一。

输出

返回值

APP_ERROR:调用返回状态,具体请参见接口调用返回值参考

约束说明

  • 此处数组“baseRawData”的长度应该为dim * nTotal。nTotal 为准备添加进入底库内部的向量数量,dim为每个向量的维度。
  • 底库向量总数的取值范围:10000 ≤ nTotal ≤ 1e8。
  • “ids”长度必须为nTotal,用户需要根据自己的业务场景,保证“ids”的合法性,如底库中存在重复的ID,检索结果中的"label"将无法对应具体的底库向量。
  • 该算法不支持添加完底库之后再次添加。AddWithIds接口不能与Add接口混用。