diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-05-14 17:54:58 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-05-14 17:54:58 +0000 |
commit | 6f5a1c69ba2ed4b7eddbd0e3a0b85542626fd665 (patch) | |
tree | ee959b4d6114fa434c4f3d664410c538e916bd79 /searchcore/src | |
parent | a3a3b1838b04cd35c13f1fc99dea5d90aef15c38 (diff) |
minor fixes after review
Diffstat (limited to 'searchcore/src')
3 files changed, 14 insertions, 9 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/white_list_provider.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/white_list_provider.h index 95f949c3e09..99e0bf8d103 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/white_list_provider.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/white_list_provider.h @@ -1,13 +1,16 @@ // Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/searchlib/common/bitvector.h> +#include <memory> #pragma once +namespace search { class BitVector; } + namespace proton::documentmetastore { +/** Interface for fetching a copy of the white list bitvector */ struct WhiteListProvider { - virtual search::BitVector::UP get_white_list_filter() const = 0; + virtual std::unique_ptr<search::BitVector> get_white_list_filter() const = 0; protected: ~WhiteListProvider() = default; }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.cpp b/searchcore/src/vespa/searchcore/proton/matching/query.cpp index 20c7ab812dd..d7c0ac04ce5 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/query.cpp @@ -157,11 +157,7 @@ void Query::setWhiteListBlueprint(Blueprint::UP whiteListBlueprint) { _whiteListBlueprint = std::move(whiteListBlueprint); - using proton::documentmetastore::WhiteListProvider; - auto wlf = dynamic_cast<WhiteListProvider *>(_whiteListBlueprint.get()); - if (wlf) { - _global_white_list = wlf->get_white_list_filter(); - } + _white_list_provider = dynamic_cast<WhiteListProvider *>(_whiteListBlueprint.get()); } void @@ -197,7 +193,10 @@ Query::optimize() using search::queryeval::GlobalFilter; _blueprint = Blueprint::optimize(std::move(_blueprint)); if (_blueprint->getState().want_global_filter()) { - auto global_filter = GlobalFilter::create(std::move(_global_white_list)); + auto white_list = (_white_list_provider ? + _white_list_provider->get_white_list_filter() : + search::BitVector::UP()); + auto global_filter = GlobalFilter::create(std::move(white_list)); _blueprint->set_global_filter(*global_filter); // optimized order may change after accounting for global filter: _blueprint = Blueprint::optimize(std::move(_blueprint)); diff --git a/searchcore/src/vespa/searchcore/proton/matching/query.h b/searchcore/src/vespa/searchcore/proton/matching/query.h index 6db4bf72425..4ca66fb7a86 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/query.h +++ b/searchcore/src/vespa/searchcore/proton/matching/query.h @@ -10,6 +10,8 @@ #include <vespa/searchlib/queryeval/blueprint.h> #include <vespa/searchlib/queryeval/irequestcontext.h> +namespace proton::documentmetastore { struct WhiteListProvider; } + namespace proton::matching { class ViewResolver; @@ -19,11 +21,12 @@ class Query { private: using Blueprint=search::queryeval::Blueprint; + using WhiteListProvider=proton::documentmetastore::WhiteListProvider; search::query::Node::UP _query_tree; Blueprint::UP _blueprint; search::fef::Location _location; Blueprint::UP _whiteListBlueprint; - search::BitVector::UP _global_white_list; + WhiteListProvider *_white_list_provider; public: Query(); |