Skip to content

Commit

Permalink
Merge pull request #32179 from vespa-engine/balder/minor-cleanup
Browse files Browse the repository at this point in the history
Minor code modernization.
  • Loading branch information
baldersheim authored Aug 19, 2024
2 parents 5e430ac + e787c1c commit ba37b7b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/testkit/test_kit.h>
#include <utility>
#include <vespa/vespalib/testkit/test_master.hpp>

using namespace proton::matching;
Expand Down Expand Up @@ -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; }
Expand All @@ -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));
}
Expand Down
4 changes: 1 addition & 3 deletions searchlib/src/vespa/searchlib/queryeval/andnotsearch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions searchlib/src/vespa/searchlib/queryeval/andnotsearch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<SearchIterator> create(ChildrenIterators children, bool strict);
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions searchlib/src/vespa/searchlib/queryeval/termwise_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ SearchIterator::UP
make_termwise(SearchIterator::UP search, bool strict)
{
if (strict) {
return SearchIterator::UP(new TermwiseSearch<true>(std::move(search)));
return std::make_unique<TermwiseSearch<true>>(std::move(search));
} else {
return SearchIterator::UP(new TermwiseSearch<false>(std::move(search)));
return std::make_unique<TermwiseSearch<false>>(std::move(search));
}
}

Expand Down

0 comments on commit ba37b7b

Please sign in to comment.