summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@verizonmedia.com>2020-06-30 10:52:05 +0200
committerGitHub <noreply@github.com>2020-06-30 10:52:05 +0200
commitf4b107073f2b8352a63f981c290909fc10ba6c8e (patch)
tree5ed4a491100b416afc9740eadc47ac9139cbb8eb /searchcore
parent5aea1d09520da60523f5f972b50890ce930d6d54 (diff)
parent1885eff6b6ab74e8a2ce402fc849a7e31ef50fbf (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')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/query.h2
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();
/**