summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2020-06-23 15:48:20 +0200
committerTor Egge <Tor.Egge@broadpark.no>2020-06-23 17:19:35 +0200
commit1885eff6b6ab74e8a2ce402fc849a7e31ef50fbf (patch)
treec77c0365aeb4169461a5410bf03efbd2916896dd /searchcore
parent7a7279d2980cd4099b8070cbf0c298dc8d666301 (diff)
If the estimated rate of matching documents is less than global filter limit then
don't build a global filter.
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();
/**