diff options
Diffstat (limited to 'streamingvisitors')
24 files changed, 81 insertions, 90 deletions
diff --git a/streamingvisitors/src/tests/searcher/searcher_test.cpp b/streamingvisitors/src/tests/searcher/searcher_test.cpp index 83b84fffa11..64952dbe5b5 100644 --- a/streamingvisitors/src/tests/searcher/searcher_test.cpp +++ b/streamingvisitors/src/tests/searcher/searcher_test.cpp @@ -114,7 +114,7 @@ struct SnippetModifierSetup SnippetModifierSetup::SnippetModifierSetup(const StringList & terms) : query(terms), - searcher(new UTF8SubstringSnippetModifier()), + searcher(new UTF8SubstringSnippetModifier(0)), env(), modifier(searcher) { @@ -361,7 +361,7 @@ assertFieldInfo(FieldSearcher & fs, const StringList & query, void assertSnippetModifier(const StringList & query, const std::string & fv, const std::string & exp) { - UTF8SubstringSnippetModifier mod; + UTF8SubstringSnippetModifier mod(0); performSearch(mod, query, StringFieldValue(fv)); EXPECT_EQUAL(mod.getModifiedBuf().getPos(), exp.size()); std::string actual(mod.getModifiedBuf().getBuffer(), mod.getModifiedBuf().getPos()); @@ -659,7 +659,7 @@ TEST("integer search") TEST("floating point search") { - FloatFieldSearcher fs; + FloatFieldSearcher fs(0); TEST_DO(assertFloat(fs, "10", 10, true)); TEST_DO(assertFloat(fs, "10.5", 10.5, true)); TEST_DO(assertFloat(fs, "-10.5", -10.5, true)); @@ -726,7 +726,7 @@ TEST("Snippet modifier search") { "\xe7\x9f\xb3\x1f\xe6\x98\x8e\xe5\x87\xb1\x1f\xe5\x9c\xa8"); { // check that resizing works - UTF8SubstringSnippetModifier mod; + UTF8SubstringSnippetModifier mod(0); EXPECT_EQUAL(mod.getModifiedBuf().getLength(), 32u); EXPECT_EQUAL(mod.getModifiedBuf().getPos(), 0u); performSearch(mod, StringList().add("a"), StringFieldValue("aaaaaaaaaaaaaaaa")); diff --git a/streamingvisitors/src/tests/textutil/textutil_test.cpp b/streamingvisitors/src/tests/textutil/textutil_test.cpp index b926444e4df..f7f340a2182 100644 --- a/streamingvisitors/src/tests/textutil/textutil_test.cpp +++ b/streamingvisitors/src/tests/textutil/textutil_test.cpp @@ -2,7 +2,6 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/fastlib/text/normwordfolder.h> -#include <vespa/searchlib/query/base.h> #include <vespa/vsm/searcher/fold.h> #include <vespa/vsm/searcher/futf8strchrfieldsearcher.h> #include <vespa/vsm/searcher/utf8stringfieldsearcherbase.h> @@ -66,7 +65,7 @@ TextUtilTest::assertSkipSeparators(const char * input, size_t len, const UCS4V & const byte * srcbuf = reinterpret_cast<const byte *>(input); auto dstbuf = std::make_unique<ucs4_t[]>(len + 1); auto offsets = std::make_unique<size_t[]>(len + 1); - UTF8StrChrFieldSearcher fs; + UTF8StrChrFieldSearcher fs(0); BW bw(dstbuf.get(), offsets.get()); size_t dstlen = fs.skipSeparators(srcbuf, len, bw); EXPECT_EQUAL(dstlen, expdstbuf.size()); diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp index 4161adaf21f..88556778481 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp @@ -326,20 +326,41 @@ SearchVisitor::is_text_matching(vespalib::stringref index) const noexcept { return false; } +namespace { + +uint32_t +count_exact(const vsm::FieldSearchSpecMapT & specMap, const StringFieldIdTMap & fieldIdMap) { + size_t count = 0; + for (const auto & fieldId : fieldIdMap.map()) { + auto found = specMap.find(fieldId.second); + if ((found != specMap.end()) && found->second.searcher().exact()) { + count++; + } + } + return count; +} + +uint32_t +count_cased(const vsm::FieldSearchSpecMapT & specMap, const StringFieldIdTMap & fieldIdMap) { + size_t count = 0; + for (const auto & fieldId : fieldIdMap.map()) { + auto found = specMap.find(fieldId.second); + if ((found != specMap.end()) && found->second.searcher().cased()) { + count++; + } + } + return count; +} + +} + SearchMethodInfo::Normalizing SearchVisitor::normalizing_mode(vespalib::stringref index) const noexcept { StringFieldIdTMap fieldIdMap; _fieldSearchSpecMap.addFieldsFromIndex(index, fieldIdMap); - size_t num_exact = 0; - for (const auto & fieldId : fieldIdMap.map()) { - auto found = _fieldSearchSpecMap.specMap().find(fieldId.second); - if ((found != _fieldSearchSpecMap.specMap().end()) && found->second.searcher().exact()) { - num_exact++; - } - } - return ((num_exact == 0) || (num_exact != fieldIdMap.map().size())) - ? Normalizing::LOWERCASE_AND_FOLD - : Normalizing::LOWERCASE; + if (count_cased(_fieldSearchSpecMap.specMap(), fieldIdMap) == fieldIdMap.map().size()) return Normalizing::NONE; + if (count_exact(_fieldSearchSpecMap.specMap(), fieldIdMap) == fieldIdMap.map().size()) return Normalizing::LOWERCASE; + return Normalizing::LOWERCASE_AND_FOLD; } void diff --git a/streamingvisitors/src/vespa/vsm/searcher/boolfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/boolfieldsearcher.h index c7e7d2e74bd..3708cca85fb 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/boolfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/boolfieldsearcher.h @@ -9,8 +9,8 @@ class BoolFieldSearcher : public FieldSearcher { public: std::unique_ptr<FieldSearcher> duplicate() const override; - BoolFieldSearcher(FieldIdT fId); - ~BoolFieldSearcher(); + explicit BoolFieldSearcher(FieldIdT fId); + ~BoolFieldSearcher() override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, const vsm::FieldPathMapT& field_paths, diff --git a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h index e64c41f814f..663592ed6d3 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/fieldsearcher.h @@ -39,7 +39,8 @@ public: PREFIX, SUBSTRING, SUFFIX, - EXACT + EXACT, + CASED }; explicit FieldSearcher(FieldIdT fId) noexcept : FieldSearcher(fId, false) {} @@ -56,6 +57,7 @@ public: bool substring() const { return _matchType == SUBSTRING; } bool suffix() const { return _matchType == SUFFIX; } bool exact() const { return _matchType == EXACT; } + bool cased() const { return _matchType == CASED; } void setMatchType(MatchType mt) { _matchType = mt; } static void init(); static search::byte fold(search::byte c) { return _foldLowCase[c]; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h index 07b3f6e1c5f..85341472c26 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/floatfieldsearcher.h @@ -9,8 +9,8 @@ template <typename T> class FloatFieldSearcherT : public FieldSearcher { public: - FloatFieldSearcherT(FieldIdT fId=0); - ~FloatFieldSearcherT(); + explicit FloatFieldSearcherT(FieldIdT fId); + ~FloatFieldSearcherT() override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, const vsm::FieldPathMapT& field_paths, @@ -42,14 +42,14 @@ class FloatFieldSearcher : public FloatFieldSearcherTF { public: std::unique_ptr<FieldSearcher> duplicate() const override; - FloatFieldSearcher(FieldIdT fId=0) : FloatFieldSearcherTF(fId) { } + explicit FloatFieldSearcher(FieldIdT fId) : FloatFieldSearcherTF(fId) { } }; class DoubleFieldSearcher : public FloatFieldSearcherTD { public: std::unique_ptr<FieldSearcher> duplicate() const override; - DoubleFieldSearcher(FieldIdT fId=0) : FloatFieldSearcherTD(fId) { } + DoubleFieldSearcher(FieldIdT fId) : FloatFieldSearcherTD(fId) { } }; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp index d7d73899e53..c0b5117d6bf 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp @@ -19,10 +19,6 @@ FUTF8StrChrFieldSearcher::duplicate() const return std::make_unique<FUTF8StrChrFieldSearcher>(*this); } -FUTF8StrChrFieldSearcher::FUTF8StrChrFieldSearcher() - : UTF8StrChrFieldSearcher(), - _folded(4_Ki) -{ } FUTF8StrChrFieldSearcher::FUTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StrChrFieldSearcher(fId), _folded(4_Ki) diff --git a/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h index 5d5ca3d6c3c..b8aa287070a 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h @@ -9,15 +9,14 @@ class FUTF8StrChrFieldSearcher : public UTF8StrChrFieldSearcher { public: std::unique_ptr<FieldSearcher> duplicate() const override; - FUTF8StrChrFieldSearcher(); - FUTF8StrChrFieldSearcher(FieldIdT fId); + explicit FUTF8StrChrFieldSearcher(FieldIdT fId); ~FUTF8StrChrFieldSearcher() override; static bool ansiFold(const char * toFold, size_t sz, char * folded); static bool lfoldaa(const char * toFold, size_t sz, char * folded, size_t & unalignedStart); static bool lfoldua(const char * toFold, size_t sz, char * folded, size_t & alignedStart); private: size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; - size_t matchTerms(const FieldRef&, const size_t shortestTerm) override; + size_t matchTerms(const FieldRef&, size_t shortestTerm) override; virtual size_t match(const char *folded, size_t sz, search::streaming::QueryTerm & qt); size_t match(const char *folded, size_t sz, size_t mintsz, search::streaming::QueryTerm ** qtl, size_t qtlSize); std::vector<char> _folded; diff --git a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h index 741148fbca1..17c9f23fefb 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/geo_pos_field_searcher.h @@ -8,8 +8,8 @@ namespace vsm { class GeoPosFieldSearcher : public FieldSearcher { public: - GeoPosFieldSearcher(FieldIdT fId=0); - ~GeoPosFieldSearcher(); + GeoPosFieldSearcher(FieldIdT fId); + ~GeoPosFieldSearcher() override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, const vsm::FieldPathMapT& field_paths, @@ -21,7 +21,7 @@ protected: using GeoLocation = search::common::GeoLocation; class GeoPosInfo : public GeoLocation { public: - GeoPosInfo (GeoLocation loc) noexcept : GeoLocation(std::move(loc)) {} + explicit GeoPosInfo (GeoLocation loc) noexcept : GeoLocation(std::move(loc)) {} bool cmp(const document::StructFieldValue & fv) const; }; using GeoPosInfoListT = std::vector<GeoPosInfo>; diff --git a/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h index 47b83c1538d..9c63d31e3c3 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/intfieldsearcher.h @@ -9,8 +9,8 @@ class IntFieldSearcher : public FieldSearcher { public: std::unique_ptr<FieldSearcher> duplicate() const override; - IntFieldSearcher(FieldIdT fId=0); - ~IntFieldSearcher(); + explicit IntFieldSearcher(FieldIdT fId); + ~IntFieldSearcher() override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, const vsm::FieldPathMapT& field_paths, diff --git a/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.h b/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.h index 5629b443c78..d08c2fbbc83 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/nearest_neighbor_field_searcher.h @@ -43,7 +43,7 @@ private: public: NearestNeighborFieldSearcher(FieldIdT fid, search::attribute::DistanceMetric metric); - ~NearestNeighborFieldSearcher(); + ~NearestNeighborFieldSearcher() override; std::unique_ptr<FieldSearcher> duplicate() const override; void prepare(search::streaming::QueryTermList& qtl, diff --git a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.h index 9ad76712092..19c723d060d 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/strchrfieldsearcher.h @@ -8,8 +8,7 @@ namespace vsm { class StrChrFieldSearcher : public FieldSearcher { public: - StrChrFieldSearcher() : FieldSearcher(0) { } - StrChrFieldSearcher(FieldIdT fId) : FieldSearcher(fId) { } + explicit StrChrFieldSearcher(FieldIdT fId) : FieldSearcher(fId) { } void onValue(const document::FieldValue & fv) override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, @@ -19,7 +18,7 @@ private: size_t shortestTerm() const; bool matchDoc(const FieldRef & field); virtual size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) = 0; - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) = 0; + virtual size_t matchTerms(const FieldRef & f, size_t shortestTerm) = 0; }; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h index dd6f31581a0..a01a9cd088d 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8exactstringfieldsearcher.h @@ -17,7 +17,7 @@ protected: public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8ExactStringFieldSearcher(FieldIdT fId) + explicit UTF8ExactStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { setMatchType(EXACT); diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.cpp index 655b068e152..78f491198ad 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.cpp @@ -58,10 +58,6 @@ UTF8FlexibleStringFieldSearcher::matchTerm(const FieldRef & f, QueryTerm & qt) } } -UTF8FlexibleStringFieldSearcher::UTF8FlexibleStringFieldSearcher() : - UTF8StringFieldSearcherBase() -{ } - UTF8FlexibleStringFieldSearcher::UTF8FlexibleStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h index 5eee6a8862a..04fbee96d36 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8flexiblestringfieldsearcher.h @@ -17,18 +17,17 @@ private: * Tries to match the given query term against the content of the given field reference. * Search strategy is choosen based on the query term type. **/ - virtual size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; + size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; /** * Tries to match each query term in the underlying query against the content of the given field reference. * Search strategy is choosen based on the query term type. **/ - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerms(const FieldRef & f, size_t shortestTerm) override; public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8FlexibleStringFieldSearcher(); - UTF8FlexibleStringFieldSearcher(FieldIdT fId); + explicit UTF8FlexibleStringFieldSearcher(FieldIdT fId); }; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.cpp index 651d1dcad9f..00828bcc7b1 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.cpp @@ -14,7 +14,7 @@ UTF8StrChrFieldSearcher::duplicate() const } size_t -UTF8StrChrFieldSearcher::matchTerms(const FieldRef & f, const size_t mintsz) +UTF8StrChrFieldSearcher::matchTerms(const FieldRef & f, size_t mintsz) { (void) mintsz; termcount_t words(0); diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h index cfe546bc6f6..663ee3a1a62 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h @@ -13,12 +13,10 @@ class UTF8StrChrFieldSearcher : public UTF8StringFieldSearcherBase { public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8StrChrFieldSearcher() : UTF8StringFieldSearcherBase() { } - UTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } - + explicit UTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } protected: size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; - size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerms(const FieldRef & f, size_t shortestTerm) override; }; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp b/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp index ebdf69d0b30..1148083b042 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp @@ -209,11 +209,6 @@ UTF8StringFieldSearcherBase::matchTermSuffix(const FieldRef & f, QueryTerm & qt) return words; } -UTF8StringFieldSearcherBase::UTF8StringFieldSearcherBase() : - StrChrFieldSearcher() -{ -} - UTF8StringFieldSearcherBase::UTF8StringFieldSearcherBase(FieldIdT fId) : StrChrFieldSearcher(fId) { diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h b/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h index 38aac508f4f..1362b3c4f1d 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h @@ -28,8 +28,8 @@ public: ucs4_t * _cbuf; public: - BufferWrapper(ucs4_t * buf) : _bbuf(buf), _cbuf(buf) { } - BufferWrapper(ucs4_t * buf, size_t *) : _bbuf(buf), _cbuf(buf) { } + explicit BufferWrapper(ucs4_t * buf) noexcept : _bbuf(buf), _cbuf(buf) { } + BufferWrapper(ucs4_t * buf, size_t *) noexcept : _bbuf(buf), _cbuf(buf) { } void onCharacter(ucs4_t ch, size_t) { *_cbuf++ = ch; } void onOffset(size_t) { } void incBuf(size_t inc) { _cbuf += inc; } @@ -50,7 +50,7 @@ public: size_t * _coff; public: - OffsetWrapper(ucs4_t * buf, size_t * offsets) : BufferWrapper(buf), _boff(offsets), _coff(offsets) {} + explicit OffsetWrapper(ucs4_t * buf, size_t * offsets) noexcept : BufferWrapper(buf), _boff(offsets), _coff(offsets) {} void onCharacter(ucs4_t ch, size_t of) { *_cbuf++ = ch; *_coff++ = of; } void onOffset(size_t of) { *_coff++ = of; } bool valid() { return (size() == (size_t)(_coff - _boff)); } @@ -103,9 +103,8 @@ protected: size_t matchTermExact(const FieldRef & f, search::streaming::QueryTerm & qt); public: - UTF8StringFieldSearcherBase(); - UTF8StringFieldSearcherBase(FieldIdT fId); - ~UTF8StringFieldSearcherBase(); + explicit UTF8StringFieldSearcherBase(FieldIdT fId); + ~UTF8StringFieldSearcherBase() override; void prepare(search::streaming::QueryTermList& qtl, const SharedSearcherBuf& buf, const vsm::FieldPathMapT& field_paths, diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.cpp b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.cpp index 25ef9ae7618..fcc2893a71d 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.cpp @@ -1,6 +1,6 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vsm/searcher/utf8substringsearcher.h> +#include "utf8substringsearcher.h" #include <vespa/fastlib/text/unicodeutil.h> using search::byte; diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.h index b1455d5c5f6..22ecf9c41fa 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsearcher.h @@ -12,11 +12,10 @@ class UTF8SubStringFieldSearcher : public UTF8StringFieldSearcherBase { public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8SubStringFieldSearcher() : UTF8StringFieldSearcherBase() { } - UTF8SubStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } + explicit UTF8SubStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } protected: size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; - size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerms(const FieldRef & f, size_t shortestTerm) override; }; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp index 8403e69658f..6d8a399cd33 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp @@ -110,20 +110,11 @@ UTF8SubstringSnippetModifier::insertSeparators(const char * mbegin, const char * _modified->put(_unitSep); } -UTF8SubstringSnippetModifier::UTF8SubstringSnippetModifier() : - UTF8StringFieldSearcherBase(), - _modified(new CharBuffer(32)), - _offsets(new std::vector<size_t>(32)), - _readPtr(NULL), - _unitSep(juniper::separators::unit_separator) -{ -} - UTF8SubstringSnippetModifier::UTF8SubstringSnippetModifier(FieldIdT fId) : UTF8StringFieldSearcherBase(fId), _modified(new CharBuffer(32)), _offsets(new std::vector<size_t>(32)), - _readPtr(NULL), + _readPtr(nullptr), _unitSep(juniper::separators::unit_separator) { } @@ -134,12 +125,12 @@ UTF8SubstringSnippetModifier::UTF8SubstringSnippetModifier(FieldIdT fId, UTF8StringFieldSearcherBase(fId), _modified(modBuf), _offsets(offBuf), - _readPtr(NULL), + _readPtr(nullptr), _unitSep(juniper::separators::unit_separator) { } -UTF8SubstringSnippetModifier::~UTF8SubstringSnippetModifier() {} +UTF8SubstringSnippetModifier::~UTF8SubstringSnippetModifier() = default; } diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h index ebb806de61c..99e6c29961f 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h @@ -23,8 +23,8 @@ private: const char * _readPtr; // buffer to read from (field reference) char _unitSep; // the unit separator character to use - virtual size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; + size_t matchTerms(const FieldRef & f, size_t shortestTerm) override; /** * Copies n bytes from the field reference to the modified buffer and updates the read pointer. @@ -51,9 +51,8 @@ public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8SubstringSnippetModifier(); - UTF8SubstringSnippetModifier(FieldIdT fId); - ~UTF8SubstringSnippetModifier(); + explicit UTF8SubstringSnippetModifier(FieldIdT fId); + ~UTF8SubstringSnippetModifier() override; /** * Creates a new instance. diff --git a/streamingvisitors/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h b/streamingvisitors/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h index 556f61a714f..c20710e63ab 100644 --- a/streamingvisitors/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h +++ b/streamingvisitors/src/vespa/vsm/searcher/utf8suffixstringfieldsearcher.h @@ -1,7 +1,7 @@ // Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vsm/searcher/utf8stringfieldsearcherbase.h> +#include "utf8stringfieldsearcherbase.h" namespace vsm { @@ -12,13 +12,12 @@ namespace vsm class UTF8SuffixStringFieldSearcher : public UTF8StringFieldSearcherBase { protected: - virtual size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerm(const FieldRef & f, search::streaming::QueryTerm & qt) override; + size_t matchTerms(const FieldRef & f, size_t shortestTerm) override; public: std::unique_ptr<FieldSearcher> duplicate() const override; - UTF8SuffixStringFieldSearcher() : UTF8StringFieldSearcherBase() { } - UTF8SuffixStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } + explicit UTF8SuffixStringFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } }; } |