diff options
author | Håvard Pettersen <havardpe@yahooinc.com> | 2023-02-06 12:22:40 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@yahooinc.com> | 2023-02-06 12:22:40 +0000 |
commit | a9da95d77e635260f203d5124588ad8a30702a57 (patch) | |
tree | 9bcb7e921090b253783ad2340cd33c7f1891d2c9 | |
parent | 95e694413c0d4638c95e1d1285b6a45727dc616a (diff) |
do not allow reusing search
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp | 5 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/matching/match_tools.h | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index 86b21445919..980c3345527 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -84,8 +84,9 @@ MatchTools::setup(std::unique_ptr<RankProgram> rank_program, ExecutionProfiler * HandleRecorder::Binder bind(recorder); _rank_program->setup(*_match_data, _queryEnv, _featureOverrides, profiler); } - bool can_reuse_search = (_search && !_search_has_changed && - contains_all(_used_handles, recorder.get_handles())); + bool can_reuse_search = (allow_reuse_search() && + _search && !_search_has_changed && + contains_all(_used_handles, recorder.get_handles())); if (!can_reuse_search) { recorder.tag_match_data(*_match_data); _match_data->set_termwise_limit(termwise_limit); diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h index fda0c86b24e..b00415a309f 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h @@ -82,6 +82,15 @@ public: void setup_match_features(); void setup_summary(); void setup_dump(); + + // explicitly disallow re-using the search iterator tree (for now) + // + // Iterators with internal state that limits the number of hits + // produced may not match a document during second phase ranking + // that was matched during first phase ranking. Note that the + // inverse may also happen; matching a document during second + // phase matching that was not matched during first phase ranking. + constexpr bool allow_reuse_search() const noexcept { return false; } }; class AttributeOperationTask { |