mirror of https://github.com/milvus-io/milvus.git
Optimize segcore API GetResultData (#10548)
Signed-off-by: yudong.cai <yudong.cai@zilliz.com>pull/10578/head
parent
880e375b00
commit
e4909c1c0b
|
@ -94,7 +94,7 @@ GetResultData(std::vector<std::vector<int64_t>>& search_records,
|
||||||
// remove duplicates
|
// remove duplicates
|
||||||
if (curr_pk == -1 || std::abs(curr_dis - prev_dis) > 0.00001) {
|
if (curr_pk == -1 || std::abs(curr_dis - prev_dis) > 0.00001) {
|
||||||
result_pair.search_result_->result_offsets_.push_back(loc_offset++);
|
result_pair.search_result_->result_offsets_.push_back(loc_offset++);
|
||||||
search_records[index].push_back(result_pair.offset_++);
|
search_records[index].push_back(result_pair.offset_);
|
||||||
prev_dis = curr_dis;
|
prev_dis = curr_dis;
|
||||||
prev_pk_set.clear();
|
prev_pk_set.clear();
|
||||||
prev_pk_set.insert(curr_pk);
|
prev_pk_set.insert(curr_pk);
|
||||||
|
@ -105,15 +105,15 @@ GetResultData(std::vector<std::vector<int64_t>>& search_records,
|
||||||
// e3: [100, 0.99] ==> duplicated, should remove
|
// e3: [100, 0.99] ==> duplicated, should remove
|
||||||
if (prev_pk_set.count(curr_pk) == 0) {
|
if (prev_pk_set.count(curr_pk) == 0) {
|
||||||
result_pair.search_result_->result_offsets_.push_back(loc_offset++);
|
result_pair.search_result_->result_offsets_.push_back(loc_offset++);
|
||||||
search_records[index].push_back(result_pair.offset_++);
|
search_records[index].push_back(result_pair.offset_);
|
||||||
// prev_pk_set keeps all primary keys with same distance
|
// prev_pk_set keeps all primary keys with same distance
|
||||||
prev_pk_set.insert(curr_pk);
|
prev_pk_set.insert(curr_pk);
|
||||||
} else {
|
} else {
|
||||||
// the entity with same distance and same primary key must be duplicated
|
// the entity with same distance and same primary key must be duplicated
|
||||||
result_pair.offset_++;
|
|
||||||
LOG_SEGCORE_DEBUG_ << "skip duplicated search result, primary key " << curr_pk;
|
LOG_SEGCORE_DEBUG_ << "skip duplicated search result, primary key " << curr_pk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
result_pair.offset_++;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue