diff options
author | Geir Storli <geirst@verizonmedia.com> | 2020-06-30 10:52:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-30 10:52:05 +0200 |
commit | f4b107073f2b8352a63f981c290909fc10ba6c8e (patch) | |
tree | 5ed4a491100b416afc9740eadc47ac9139cbb8eb /searchcore | |
parent | 5aea1d09520da60523f5f972b50890ce930d6d54 (diff) | |
parent | 1885eff6b6ab74e8a2ce402fc849a7e31ef50fbf (diff) |
Merge pull request #13673 from vespa-engine/toregge/add-global-filter-limit
If the estimated rate of matching documents is less than global filteā¦
Diffstat (limited to 'searchcore')
3 files changed, 6 insertions, 4 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index fadea4b7962..19bece5ae9c 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -194,7 +194,8 @@ MatchToolsFactory(QueryLimiter & queryLimiter, trace.addEvent(4, "MTF: Fetch Postings"); _query.fetchPostings(); trace.addEvent(5, "MTF: Handle Global Filters"); - _query.handle_global_filters(searchContext.getDocIdLimit()); + double global_filter_limit = GlobalFilterLimit::lookup(rankProperties, rankSetup.get_global_filter_limit()); + _query.handle_global_filters(searchContext.getDocIdLimit(), global_filter_limit); _query.freeze(); trace.addEvent(5, "MTF: prepareSharedState"); _rankSetup.prepareSharedState(_queryEnv, _queryEnv.getObjectStore()); diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 5213a2b9230..62a59ab7680 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -199,10 +199,11 @@ Query::fetchPostings() } void -Query::handle_global_filters(uint32_t docid_limit) +Query::handle_global_filters(uint32_t docid_limit, double global_filter_limit) { using search::queryeval::GlobalFilter; - if (_blueprint->getState().want_global_filter()) { + double estimated_hit_ratio = _blueprint->getState().hit_ratio(docid_limit); + if (_blueprint->getState().want_global_filter() && estimated_hit_ratio >= global_filter_limit) { auto constraint = Blueprint::FilterConstraint::UPPER_BOUND; bool strict = true; auto filter_iterator = _blueprint->createFilterSearch(strict, constraint); diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index 3ed6229830d..60f40e24d1e 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -89,7 +89,7 @@ public: **/ void optimize(); void fetchPostings(); - void handle_global_filters(uint32_t docidLimit); + void handle_global_filters(uint32_t docidLimit, double global_filter_limit); void freeze(); /** |