From 5c9eafb455d9d9f012d2cbad1eb023e141364e93 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 4 Jul 2023 22:15:43 +0200 Subject: Revert "Drop checking for valid lid temporarily" --- .../src/vespa/searchcore/proton/matching/match_thread.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 38336009f14..52d7d906d4c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -68,22 +68,28 @@ fillPartialResult(ResultProcessor::Context & context, size_t totalHits, size_t n PartialResult &pr = *context.result; pr.totalHits(totalHits); size_t maxHits = std::min(numHits, pr.maxSize()); - //TODO :const search::BitVector & validLids = context._validLids; + const search::BitVector & validLids = context._validLids; if (pr.hasSortData()) { FastS_SortSpec &spec = context.sort->sortSpec; for (size_t i = 0; i < maxHits; ++i) { - pr.add(hits[i], spec.getSortRef(i)); + if (validLids.testBit(hits[i].getDocId())) { + pr.add(hits[i], spec.getSortRef(i)); + } } } else { for (size_t i = 0; i < maxHits; ++i) { - pr.add(hits[i]); + if (validLids.testBit(hits[i].getDocId())) { + pr.add(hits[i]); + } } if ((bits != nullptr) && (pr.size() < pr.maxSize())) { for (unsigned int bitId = bits->getFirstTrueBit(); (bitId < bits->size()) && (pr.size() < pr.maxSize()); bitId = bits->getNextTrueBit(bitId + 1)) { - pr.add(search::RankedHit(bitId)); + if (validLids.testBit(bitId)) { + pr.add(search::RankedHit(bitId)); + } } } } -- cgit v1.2.3 From 607d5047f69a7e7c5700fc0352de6f811098b763 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 4 Jul 2023 20:17:17 +0000 Subject: Sample totalHits before modifying the overflow bitvector. --- searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp index 52d7d906d4c..b57346611f1 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp @@ -374,6 +374,7 @@ MatchThread::processResult(const Doom & doom, search::ResultSet::UP result, Resu result->mergeWithBitOverflow(fallback_rank_value()); } if (doom.hard_doom()) return; + size_t totalHits = result->getNumHits(); // Must be done before modifying overflow const search::RankedHit *hits = result->getArray(); size_t numHits = result->getArrayUsed(); search::BitVector *bits = result->getBitOverflow(); @@ -394,7 +395,7 @@ MatchThread::processResult(const Doom & doom, search::ResultSet::UP result, Resu man.groupInRelevanceOrder(hits, numHits); } if (doom.hard_doom()) return; - fillPartialResult(context, result->getNumHits(), numHits, hits, bits); + fillPartialResult(context, totalHits, numHits, hits, bits); if (auto task = matchToolsFactory.createOnMatchTask()) { task->run(result->copyResult()); -- cgit v1.2.3