mirror of https://github.com/milvus-io/milvus.git
parent
4825f0724a
commit
561e2f5fc8
|
@ -266,14 +266,19 @@ XSearchTask::Execute() {
|
|||
|
||||
// step 3: pick up topk result
|
||||
auto spec_k = file_->row_count_ < topk ? file_->row_count_ : topk;
|
||||
if (spec_k == 0) {
|
||||
ENGINE_LOG_WARNING << "Searching in an empty file. file location = " << file_->location_;
|
||||
}
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(search_job->mutex());
|
||||
|
||||
if (search_job->GetResultIds().front() == -1 && search_job->GetResultIds().size() > spec_k) {
|
||||
// initialized results set
|
||||
search_job->GetResultIds().resize(spec_k);
|
||||
search_job->GetResultDistances().resize(spec_k);
|
||||
if (search_job->GetResultIds().size() > spec_k) {
|
||||
if (search_job->GetResultIds().front() == -1) {
|
||||
// initialized results set
|
||||
search_job->GetResultIds().resize(spec_k * nq);
|
||||
search_job->GetResultDistances().resize(spec_k * nq);
|
||||
}
|
||||
}
|
||||
|
||||
XSearchTask::MergeTopkToResultSet(output_ids, output_distance, spec_k, nq, topk, ascending_reduce,
|
||||
|
|
Loading…
Reference in New Issue