Fix range search error (#22352)

Signed-off-by: lixinguo <xinguo.li@zilliz.com>
Co-authored-by: lixinguo <xinguo.li@zilliz.com>
pull/22244/head
smellthemoon 2023-02-23 14:21:46 +08:00 committed by GitHub
parent a9a263d5a8
commit 820d0bc060
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -46,7 +46,10 @@ SortRangeSearchResult(DatasetPtr data_set, int64_t topk, int64_t nq, std::string
// use p_id and p_dist to GenResultDataset after sorted
auto p_id = new int64_t[topk * nq];
memset(p_id, -1, sizeof(int64_t) * topk * nq);
auto p_dist = new float[topk * nq];
std::fill_n(p_dist, topk * nq, std::numeric_limits<float>::max());
// cnt means the subscript of p_id and p_dist
int cnt = 0;

View File

@ -37,7 +37,9 @@ RangeSearchSortResultBF(milvus::DatasetPtr data_set, int64_t topk, size_t nq, st
auto id = milvus::GetDatasetIDs(data_set);
auto dist = milvus::GetDatasetDistance(data_set);
auto p_id = new int64_t[topk * nq];
memset(p_id, -1, sizeof(int64_t) * topk * nq);
auto p_dist = new float[topk * nq];
std::fill_n(p_dist, topk * nq, std::numeric_limits<float>::max());
// cnt means the subscript of p_id and p_dist
int cnt = 0;
for (int i = 0; i < nq; i++) {