SearchWithMask
API定义  | 
APP_ERROR SearchWithMask(const AscendIndexSearchParams& searchParams, const std::vector<uint8_t>& mask);  | 
|---|---|
功能描述  | 
实现AscendIndexGreat特征向量查询接口,根据输入的特征向量返回最相似的“topK”条特征的距离及ID,且用户可以输入一个uint8数组来掩盖特定底库ID,使该ID对应的特征向量不参与检索。  | 
输入  | 
searchParams结构体见AscendIndexSearchParams size_t n:查询的特征向量的条数。 std::vector<float>& queryData:特征向量数据。 int topK:需要返回的最近似的结果的个数。 const std::vector<uint8_t>& mask:外部输入的额外的过滤mask,以bit为单位,0代表过滤该条特征;1代表选中该条特征。  | 
输出  | 
std::vector<float>& dists:查询向量与距离最近的前“topK”个向量间的距离值。 std::vector<int64_t>& labels:查询的距离最近的前“topK”个向量的ID。当有效的检索结果不足“topK”个时,剩余无效label用-1填充。  | 
返回值  | 
APP_ERROR:调用返回状态,具体请参见接口调用返回值参考。  | 
约束说明  | 
  | 
父主题: AscendIndexGreat