SearchWithExtraVal
API definition |
APP_ERROR SearchWithExtraVal(uint32_t count, const void *features, const AttrFilter *attrFilter, bool shareAttrFilter, uint32_t topk, int64_t *labels, float *distances, uint32_t *validNums, const ExtraValFilter *extraValFilter, bool enableTimeFilter = true); |
|---|---|
Function |
Calculates the distance between the input feature and the base vector filtered by AttrFilter and ExtraValFilter, sorts the distance by TopK, and returns the corresponding distance and index. |
Input |
uint32_t count: number of features to be compared. const void *features: feature to be compared. The Hamming distance requires data of the uint8_t type, and Int8cos requires data of the int8_t type. Currently, only Int8cos and Hamming distance are supported. const AttrFilter *attrFilter: attribute filtering information. For details, see SearchWithExtraMask. bool shareAttrFilter: extra attribute. Currently, only false is supported. Different queries do not share the same mask. uint32_t topk: size of the TopK feature to be saved after the cosine distance is calculated. const ExtraValFilter *extraValFilter: extra attribute filtering information. For details, see tokenBitSetLen. bool enableTimeFilter: whether to filter the timestamp attribute. The default value is true. If enableTimeFilter is set to false, the timestamp attribute is not filtered. |
Output |
uint32_t *validNums: number of valid results obtained after each query vector is compared. int64_t *labels: label of the TopK feature. float *distances: distance of the TopK feature. |
Return value |
APP_ERROR: return status. For details, see Return Code Reference. |
Restrictions |
|
SearchWithExtraVal cannot be used together with Search.