Merge branch 'branch-0.5.0' into '0.5.0'

#59 Topk result is incorrect for small dataset

See merge request megasearch/milvus!781

Former-commit-id: de0ec9a3b42ef78a1383c8228f8c604b8175216d
This commit is contained in:
jinhai 2019-10-21 16:47:20 +08:00
commit 1172d9e99d
2 changed files with 3 additions and 2 deletions

View File

@ -34,6 +34,7 @@ Please mark all change in change log and use the ticket from JIRA.
- \#39 - Create SQ8H index hang if using github server version
- \#30 - Some troubleshoot messages in Milvus do not provide enough information
- \#48 - Config unittest failed
- \#59 - Topk result is incorrect for small dataset
## Improvement
- MS-552 - Add and change the easylogging library

View File

@ -253,7 +253,7 @@ XSearchTask::MergeTopkToResultSet(const std::vector<int64_t>& input_ids, const s
if (result[i].empty()) {
result_buf.resize(input_k, scheduler::IdDistPair(-1, 0.0));
uint64_t input_k_multi_i = input_k * i;
uint64_t input_k_multi_i = topk * i;
for (auto k = 0; k < input_k; ++k) {
uint64_t idx = input_k_multi_i + k;
auto& result_buf_item = result_buf[k];
@ -266,7 +266,7 @@ XSearchTask::MergeTopkToResultSet(const std::vector<int64_t>& input_ids, const s
result_buf.resize(output_k, scheduler::IdDistPair(-1, 0.0));
size_t buf_k = 0, src_k = 0, tar_k = 0;
uint64_t src_idx;
uint64_t input_k_multi_i = input_k * i;
uint64_t input_k_multi_i = topk * i;
while (buf_k < output_k && src_k < input_k && tar_k < tar_size) {
src_idx = input_k_multi_i + src_k;
auto& result_buf_item = result_buf[buf_k];