From e787c1c6e6150ea1defc799a76e9419169e4d025 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 19 Aug 2024 21:32:38 +0000 Subject: [PATCH] Minor code modernization. --- .../match_phase_limiter_test.cpp | 17 +++++++++-------- .../vespa/searchlib/queryeval/andnotsearch.cpp | 4 +--- .../vespa/searchlib/queryeval/andnotsearch.h | 4 ++-- .../searchlib/queryeval/termwise_search.cpp | 4 ++-- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp index 30ab34374eb7..a7c1b8ebecae 100644 --- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp +++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include using namespace proton::matching; @@ -52,13 +53,13 @@ struct MockSearch : SearchIterator { bool postings_fetched; uint32_t last_seek = beginId(); uint32_t last_unpack = beginId(); - explicit MockSearch(const vespalib::string &term_in) - : spec("", 0, 0), term(term_in), _strict(vespalib::Trinary::True), tfmda(), postings_fetched(false) {} - MockSearch(const FieldSpec &spec_in, const vespalib::string &term_in, bool strict_in, - const TermFieldMatchDataArray &tfmda_in, bool postings_fetched_in) - : spec(spec_in), term(term_in), + explicit MockSearch(vespalib::string term_in) + : spec("", 0, 0), term(std::move(term_in)), _strict(vespalib::Trinary::True), tfmda(), postings_fetched(false) {} + MockSearch(const FieldSpec &spec_in, vespalib::string term_in, bool strict_in, + TermFieldMatchDataArray tfmda_in, bool postings_fetched_in) + : spec(spec_in), term(std::move(term_in)), _strict(strict_in ? vespalib::Trinary::True : vespalib::Trinary::False), - tfmda(tfmda_in), + tfmda(std::move(tfmda_in)), postings_fetched(postings_fetched_in) {} void doSeek(uint32_t docid) override { last_seek = docid; setDocId(docid); } void doUnpack(uint32_t docid) override { last_unpack = docid; } @@ -71,8 +72,8 @@ struct MockBlueprint : SimpleLeafBlueprint { vespalib::string term; bool postings_fetched = false; bool postings_strict = false; - MockBlueprint(const FieldSpec &spec_in, const vespalib::string &term_in) - : SimpleLeafBlueprint(spec_in), spec(spec_in), term(term_in) + MockBlueprint(const FieldSpec &spec_in, vespalib::string term_in) + : SimpleLeafBlueprint(spec_in), spec(spec_in), term(std::move(term_in)) { setEstimate(HitEstimate(756, false)); } diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp index 1428212e5f9e..1a674e35aec1 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp @@ -51,9 +51,7 @@ class AndNotSearchStrict : public AndNotSearchStrictBase * * @param children the search objects we are andnot'ing **/ - AndNotSearchStrict(Children children) : AndNotSearchStrictBase(std::move(children)) - { - } + explicit AndNotSearchStrict(Children children) : AndNotSearchStrictBase(std::move(children)) { } void initRange(uint32_t beginid, uint32_t endid) override { AndNotSearch::initRange(beginid, endid); diff --git a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h index ac1eeb63578c..51072bebd156 100644 --- a/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/andnotsearch.h @@ -24,7 +24,7 @@ class AndNotSearch : public MultiSearch * * @param children the search objects we are andnot'ing **/ - AndNotSearch(MultiSearch::Children children) : MultiSearch(std::move(children)) { } + explicit AndNotSearch(MultiSearch::Children children) : MultiSearch(std::move(children)) { } public: static std::unique_ptr create(ChildrenIterators children, bool strict); @@ -42,7 +42,7 @@ class AndNotSearch : public MultiSearch class AndNotSearchStrictBase : public AndNotSearch { protected: - AndNotSearchStrictBase(Children children) : AndNotSearch(std::move(children)) { } + explicit AndNotSearchStrictBase(Children children) : AndNotSearch(std::move(children)) { } private: Trinary is_strict() const override { return Trinary::True; } UP andWith(UP filter, uint32_t estimate) override; diff --git a/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp b/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp index 3cffe25d8ad7..a278f2f8260d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp @@ -57,9 +57,9 @@ SearchIterator::UP make_termwise(SearchIterator::UP search, bool strict) { if (strict) { - return SearchIterator::UP(new TermwiseSearch(std::move(search))); + return std::make_unique>(std::move(search)); } else { - return SearchIterator::UP(new TermwiseSearch(std::move(search))); + return std::make_unique>(std::move(search)); } }