Signed-off-by: Zhiru Zhu <zzhu@fandm.edu>
pull/1612/head
Zhiru Zhu 2020-03-10 21:07:11 +08:00
parent 4825f0724a
commit 561e2f5fc8
No known key found for this signature in database
GPG Key ID: AB8AD6F124821076
1 changed files with 9 additions and 4 deletions

View File

@ -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,