aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2024-06-05 16:33:38 +0200
committerTor Egge <Tor.Egge@online.no>2024-06-05 16:33:38 +0200
commit8f7b9d7588e7154c7bd4731293bab22846ae0b2e (patch)
tree7662873253ccfde8a1f63f43cf75e6934d8dcc9b /searchcore/src
parent1cac4c78f16ce4fd7816d3e0fc5e6ac3b4090508 (diff)
Use second phase rank score drop limit in match loop.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp27
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_thread.h1
2 files changed, 27 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
index 81a4b443208..7ccc120d047 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.cpp
@@ -381,7 +381,32 @@ MatchThread::findMatches(MatchTools &tools)
secondPhase(tools, hits);
}
trace->addEvent(4, "Create result set");
- return hits.getResultSet();
+ if (tools.has_second_phase_rank() && matchParams.second_phase_rank_score_drop_limit.has_value()) {
+ return get_matches_after_second_phase_rank_score_drop(hits);
+ } else {
+ return hits.getResultSet();
+ }
+}
+
+std::unique_ptr<search::ResultSet>
+MatchThread::get_matches_after_second_phase_rank_score_drop(HitCollector& hits)
+{
+ std::vector<uint32_t> dropped;
+ auto result = hits.get_result_set(matchParams.second_phase_rank_score_drop_limit, &dropped);
+ if (!dropped.empty()) {
+ /*
+ * Hits dropped due to second phase rank score drop limit are
+ * not present in the result. Schedule extra tasks to update
+ * mutable attributes for earlier match phases.
+ */
+ if (auto task = matchToolsFactory.createOnMatchTask()) {
+ task->run(dropped);
+ }
+ if (auto task = matchToolsFactory.createOnFirstPhaseTask()) {
+ task->run(std::move(dropped));
+ }
+ }
+ return result;
}
void
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
index b267e7b799c..e017dc53c5c 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_thread.h
@@ -113,6 +113,7 @@ private:
void match_loop_helper(MatchTools &tools, HitCollector &hits);
search::ResultSet::UP findMatches(MatchTools &tools);
+ std::unique_ptr<search::ResultSet> get_matches_after_second_phase_rank_score_drop(HitCollector& hits);
void secondPhase(MatchTools & tools, HitCollector & hits);
void processResult(const Doom & doom, search::ResultSet::UP result, ResultProcessor::Context &context);