diff options
author | Henning Baldersheim <balder@oath.com> | 2018-07-26 12:34:24 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-07-26 12:34:24 +0200 |
commit | d1d029837012d90df2b8aeb40a4b021084e2434d (patch) | |
tree | ff7484f3fcfc380f11711ec1b145a2f06b4653ec /searchcore | |
parent | 23d9213d4f58410cd78410dc10950b3bab86c563 (diff) |
nested namespaces
Diffstat (limited to 'searchcore')
6 files changed, 23 insertions, 39 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp index 05dc75146c7..ca96033c358 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.cpp @@ -11,8 +11,7 @@ using namespace search::query; using vespalib::make_string; using vespalib::string; -namespace proton { -namespace matching { +namespace proton::matching { AttributeLimiter::AttributeLimiter(Searchable &searchable_attributes, const IRequestContext & requestContext, @@ -35,7 +34,7 @@ AttributeLimiter::AttributeLimiter(Searchable &searchable_attributes, { } -AttributeLimiter::~AttributeLimiter() {} +AttributeLimiter::~AttributeLimiter() = default; namespace { @@ -86,5 +85,4 @@ AttributeLimiter::create_search(size_t want_hits, size_t max_group_size, bool st return _blueprint->createSearch(*_match_datas.back(), strictSearch); } -} // namespace proton::matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h index 95f7bf4e42b..c50a6e0dcb8 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h +++ b/searchcore/src/vespa/searchcore/proton/matching/attribute_limiter.h @@ -10,8 +10,7 @@ #include <vespa/searchlib/fef/matchdata.h> #include <mutex> -namespace proton { -namespace matching { +namespace proton::matching { /** * This class is responsible for creating attribute-based search @@ -51,6 +50,4 @@ private: DiversityCutoffStrategy _diversityCutoffStrategy; }; -} // namespace proton::matching -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp index ddefa7c30c9..549aee20de7 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_params.cpp @@ -2,8 +2,7 @@ #include "match_params.h" -namespace proton { -namespace matching { +namespace proton::matching { namespace { @@ -30,8 +29,6 @@ MatchParams::MatchParams(uint32_t numDocs_in, offset(offset_in), hits(hits_in), rankDropLimit(rankDropLimit_in) -{ -} +{ } -} // namespace proton::matching -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_params.h b/searchcore/src/vespa/searchcore/proton/matching/match_params.h index 50787516144..c1fd9a4ef32 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_params.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_params.h @@ -4,8 +4,7 @@ #include <vespa/searchlib/fef/fef.h> -namespace proton { -namespace matching { +namespace proton::matching { /** * Numeric matching parameters. Some of these comes from the config, @@ -30,6 +29,4 @@ struct MatchParams { bool save_rank_scores() const { return ((heapSize + arraySize) != 0); } }; -} // namespace proton::matching -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp index 805c4a94c3b..998daed16c0 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp @@ -88,16 +88,13 @@ MatchTools::MatchTools(QueryLimiter & queryLimiter, { } -MatchTools::~MatchTools() -{ -} +MatchTools::~MatchTools() = default; void MatchTools::setup_first_phase() { setup(_rankSetup.create_first_phase_program(), - TermwiseLimit::lookup(_queryEnv.getProperties(), - _rankSetup.get_termwise_limit())); + TermwiseLimit::lookup(_queryEnv.getProperties(), _rankSetup.get_termwise_limit())); } void @@ -165,36 +162,34 @@ MatchToolsFactory(QueryLimiter & queryLimiter, double diversity_cutoff_factor = DiversityCutoffFactor::lookup(rankProperties); vespalib::string diversity_cutoff_strategy = DiversityCutoffStrategy::lookup(rankProperties); if (!limit_attribute.empty() && limit_maxhits > 0) { - _match_limiter.reset(new MatchPhaseLimiter(metaStore.getCommittedDocIdLimit(), searchContext.getAttributes(), _requestContext, + _match_limiter = std::make_unique<MatchPhaseLimiter>(metaStore.getCommittedDocIdLimit(), searchContext.getAttributes(), _requestContext, limit_attribute, limit_maxhits, !limit_ascending, limit_max_filter_coverage, samplePercentage, postFilterMultiplier, - diversity_attribute, diversity_min_groups, - diversity_cutoff_factor, - AttributeLimiter::toDiversityCutoffStrategy(diversity_cutoff_strategy))); + diversity_attribute, diversity_min_groups, diversity_cutoff_factor, + AttributeLimiter::toDiversityCutoffStrategy(diversity_cutoff_strategy)); } else if (_rankSetup.hasMatchPhaseDegradation()) { - _match_limiter.reset(new MatchPhaseLimiter(metaStore.getCommittedDocIdLimit(), searchContext.getAttributes(), _requestContext, + _match_limiter = std::make_unique<MatchPhaseLimiter>(metaStore.getCommittedDocIdLimit(), searchContext.getAttributes(), _requestContext, _rankSetup.getDegradationAttribute(), _rankSetup.getDegradationMaxHits(), !_rankSetup.isDegradationOrderAscending(), _rankSetup.getDegradationMaxFilterCoverage(), _rankSetup.getDegradationSamplePercentage(), _rankSetup.getDegradationPostFilterMultiplier(), _rankSetup.getDiversityAttribute(), _rankSetup.getDiversityMinGroups(), _rankSetup.getDiversityCutoffFactor(), - AttributeLimiter::toDiversityCutoffStrategy(_rankSetup.getDiversityCutoffStrategy()))); + AttributeLimiter::toDiversityCutoffStrategy(_rankSetup.getDiversityCutoffStrategy())); } } - if (_match_limiter.get() == nullptr) { - _match_limiter.reset(new NoMatchPhaseLimiter()); + if ( ! _match_limiter) { + _match_limiter = std::make_unique<NoMatchPhaseLimiter>(); } } -MatchToolsFactory::~MatchToolsFactory() {} +MatchToolsFactory::~MatchToolsFactory() = default; MatchTools::UP MatchToolsFactory::createMatchTools() const { assert(_valid); - return MatchTools::UP( - new MatchTools(_queryLimiter, _requestContext.getSoftDoom(), _hardDoom, _query, *_match_limiter, _queryEnv, - _mdl, _rankSetup, _featureOverrides)); + return std::make_unique<MatchTools>(_queryLimiter, _requestContext.getSoftDoom(), _hardDoom, _query, + *_match_limiter, _queryEnv, _mdl, _rankSetup, _featureOverrides); } } diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp index 8de03411ea3..ed58fcef977 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp @@ -136,7 +136,7 @@ Matcher::Matcher(const search::index::Schema &schema, const Properties &props, c { search::features::setup_search_features(_blueprintFactory); search::fef::test::setup_fef_test_plugin(_blueprintFactory); - _rankSetup.reset(new search::fef::RankSetup(_blueprintFactory, _indexEnv)); + _rankSetup = std::make_shared<search::fef::RankSetup>(_blueprintFactory, _indexEnv); _rankSetup->configure(); // reads config values from the property map if (!_rankSetup->compile()) { throw vespalib::IllegalArgumentException("failed to compile rank setup", VESPA_STRLOC); |