diff options
Diffstat (limited to 'vsm')
22 files changed, 136 insertions, 124 deletions
diff --git a/vsm/src/tests/searcher/searcher.cpp b/vsm/src/tests/searcher/searcher.cpp index fbbc8796a7c..3d1f6939887 100644 --- a/vsm/src/tests/searcher/searcher.cpp +++ b/vsm/src/tests/searcher/searcher.cpp @@ -2,7 +2,6 @@ #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/searchlib/query/queryterm.h> #include <vespa/vsm/searcher/fieldsearcher.h> #include <vespa/vsm/searcher/floatfieldsearcher.h> #include <vespa/vsm/searcher/futf8strchrfieldsearcher.h> @@ -13,6 +12,7 @@ #include <vespa/vsm/searcher/utf8substringsnippetmodifier.h> #include <vespa/vsm/searcher/utf8suffixstringfieldsearcher.h> #include <vespa/vsm/vsm/snippetmodifier.h> +#include <vespa/searchlib/query/queryterm.h> #include <vespa/document/fieldvalue/fieldvalues.h> using namespace document; @@ -145,35 +145,35 @@ void assertString(StrChrFieldSearcher &fs, const std::string &term, const String assertString(fs, StringList().add(term), field, HitsList().add(exp)); } -void assertInt(IntFieldSearcher fs, const StringList &query, int64_t field, const BoolList &exp) { +void assertInt(IntFieldSearcher & fs, const StringList &query, int64_t field, const BoolList &exp) { assertNumeric(fs, query, LongFieldValue(field), exp); } -void assertInt(IntFieldSearcher fs, const std::string &term, int64_t field, bool exp) { +void assertInt(IntFieldSearcher & fs, const std::string &term, int64_t field, bool exp) { assertInt(fs, StringList().add(term), field, BoolList().add(exp)); } -void assertInt(IntFieldSearcher fs, const StringList &query, const LongList &field, const HitsList &exp) { +void assertInt(IntFieldSearcher & fs, const StringList &query, const LongList &field, const HitsList &exp) { assertSearch(fs, query, getFieldValue(field), exp); } -void assertInt(IntFieldSearcher fs, const std::string &term, const LongList &field, const Hits &exp) { +void assertInt(IntFieldSearcher & fs, const std::string &term, const LongList &field, const Hits &exp) { assertInt(fs, StringList().add(term), field, HitsList().add(exp)); } -void assertFloat(FloatFieldSearcher fs, const StringList &query, float field, const BoolList &exp) { +void assertFloat(FloatFieldSearcher & fs, const StringList &query, float field, const BoolList &exp) { assertNumeric(fs, query, FloatFieldValue(field), exp); } -void assertFloat(FloatFieldSearcher fs, const std::string &term, float field, bool exp) { +void assertFloat(FloatFieldSearcher & fs, const std::string &term, float field, bool exp) { assertFloat(fs, StringList().add(term), field, BoolList().add(exp)); } -void assertFloat(FloatFieldSearcher fs, const StringList &query, const FloatList &field, const HitsList &exp) { +void assertFloat(FloatFieldSearcher & fs, const StringList &query, const FloatList &field, const HitsList &exp) { assertSearch(fs, query, getFieldValue(field), exp); } -void assertFloat(FloatFieldSearcher fs, const std::string &term, const FloatList &field, const Hits &exp) { +void assertFloat(FloatFieldSearcher & fs, const std::string &term, const FloatList &field, const Hits &exp) { assertFloat(fs, StringList().add(term), field, HitsList().add(exp)); } @@ -196,37 +196,37 @@ assertFieldInfo(StrChrFieldSearcher &fs, const std::string &term, const std::str return assertFieldInfo(fs, StringList().add(term), fv, FieldInfoList().add(exp)); } -void assertFieldInfo(IntFieldSearcher fs, const StringList &query, int64_t fv, const FieldInfoList &exp) { +void assertFieldInfo(IntFieldSearcher & fs, const StringList &query, int64_t fv, const FieldInfoList &exp) { assertFieldInfo(fs, query, LongFieldValue(fv), exp); } -void assertFieldInfo(IntFieldSearcher fs, const StringList &query, const LongList &fv, const FieldInfoList &exp) { +void assertFieldInfo(IntFieldSearcher & fs, const StringList &query, const LongList &fv, const FieldInfoList &exp) { assertFieldInfo(fs, query, getFieldValue(fv), exp); } -void assertFieldInfo(IntFieldSearcher fs, const std::string &term, int64_t fv, const QTFieldInfo &exp) { +void assertFieldInfo(IntFieldSearcher & fs, const std::string &term, int64_t fv, const QTFieldInfo &exp) { assertFieldInfo(fs, StringList().add(term), fv, FieldInfoList().add(exp)); } -void assertFieldInfo(IntFieldSearcher fs, const std::string &term, const LongList &fv, const QTFieldInfo &exp) { +void assertFieldInfo(IntFieldSearcher & fs, const std::string &term, const LongList &fv, const QTFieldInfo &exp) { assertFieldInfo(fs, StringList().add(term), fv, FieldInfoList().add(exp)); } -void assertFieldInfo(FloatFieldSearcher fs, const StringList &query, float fv, const FieldInfoList &exp) { +void assertFieldInfo(FloatFieldSearcher & fs, const StringList &query, float fv, const FieldInfoList &exp) { assertFieldInfo(fs, query, FloatFieldValue(fv), exp); } void -assertFieldInfo(FloatFieldSearcher fs, const StringList &query, const FloatList &fv, const FieldInfoList &exp) { +assertFieldInfo(FloatFieldSearcher & fs, const StringList &query, const FloatList &fv, const FieldInfoList &exp) { assertFieldInfo(fs, query, getFieldValue(fv), exp); } /** float field searcher **/ -void assertFieldInfo(FloatFieldSearcher fs, const std::string &term, float fv, const QTFieldInfo &exp) { +void assertFieldInfo(FloatFieldSearcher & fs, const std::string &term, float fv, const QTFieldInfo &exp) { assertFieldInfo(fs, StringList().add(term), fv, FieldInfoList().add(exp)); } -void assertFieldInfo(FloatFieldSearcher fs, const std::string &term, const FloatList &fv, const QTFieldInfo &exp) { +void assertFieldInfo(FloatFieldSearcher & fs, const std::string &term, const FloatList &fv, const QTFieldInfo &exp) { assertFieldInfo(fs, StringList().add(term), fv, FieldInfoList().add(exp)); } @@ -837,6 +837,4 @@ TEST("counting of words") { assertString(fs, StringList().add("bb").add("not"), field, HitsList().add(Hits().add(2)).add(Hits())); } - TEST_MAIN() { TEST_RUN_ALL(); } - diff --git a/vsm/src/vespa/vsm/searcher/fieldsearcher.h b/vsm/src/vespa/vsm/searcher/fieldsearcher.h index ee6d3f6698b..3b82f68072b 100644 --- a/vsm/src/vespa/vsm/searcher/fieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/fieldsearcher.h @@ -140,6 +140,4 @@ public: void prepare(const DocumentTypeIndexFieldMapT & difm, const SharedSearcherBuf & searcherBuf, search::Query & query); }; - } - diff --git a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.cpp b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.cpp index 6761bda71e2..eb18e99fc58 100644 --- a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.cpp +++ b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.cpp @@ -1,13 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "floatfieldsearcher.h" -#include <vespa/document/fieldvalue/fieldvalue.h> -#include <climits> using search::QueryTerm; using search::QueryTermList; -namespace vsm -{ +namespace vsm { IMPLEMENT_DUPLICATE(FloatFieldSearcher); IMPLEMENT_DUPLICATE(DoubleFieldSearcher); @@ -16,8 +14,10 @@ template<typename T> FloatFieldSearcherT<T>::FloatFieldSearcherT(FieldIdT fId) : FieldSearcher(fId), _floatTerm() -{ -} +{} + +template<typename T> +FloatFieldSearcherT<T>::~FloatFieldSearcherT() {} template<typename T> void FloatFieldSearcherT<T>::prepare(QueryTermList & qtl, const SharedSearcherBuf & buf) diff --git a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h index b39e3a96a85..bb6a60a2330 100644 --- a/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/floatfieldsearcher.h @@ -1,35 +1,35 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vsm/searcher/fieldsearcher.h> +#include "fieldsearcher.h" -namespace vsm -{ +namespace vsm { template <typename T> class FloatFieldSearcherT : public FieldSearcher { - public: - FloatFieldSearcherT(FieldIdT fId=0); - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; - virtual void onValue(const document::FieldValue & fv) override; - protected: - class FloatInfo - { - public: - FloatInfo(T low, T high, bool v) : _lower(low), _upper(high), _valid(v) { if (low > high) { _lower = high; _upper = low; } } - bool cmp(T key) const; - bool valid() const { return _valid; } - void setValid(bool v) { _valid = v; } - T getLow() const { return _lower; } - T getHigh() const { return _upper; } - private: - T _lower; - T _upper; - bool _valid; - }; - typedef std::vector<FloatInfo> FloatInfoListT; - FloatInfoListT _floatTerm; +public: + FloatFieldSearcherT(FieldIdT fId=0); + ~FloatFieldSearcherT(); + void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; + void onValue(const document::FieldValue & fv) override; +protected: + class FloatInfo + { + public: + FloatInfo(T low, T high, bool v) : _lower(low), _upper(high), _valid(v) { if (low > high) { _lower = high; _upper = low; } } + bool cmp(T key) const; + bool valid() const { return _valid; } + void setValid(bool v) { _valid = v; } + T getLow() const { return _lower; } + T getHigh() const { return _upper; } + private: + T _lower; + T _upper; + bool _valid; + }; + typedef std::vector<FloatInfo> FloatInfoListT; + FloatInfoListT _floatTerm; }; typedef FloatFieldSearcherT<float> FloatFieldSearcherTF; diff --git a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp index 760566150e6..46a109c36e9 100644 --- a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp +++ b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.cpp @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "futf8strchrfieldsearcher.h" #include "fold.h" -#include <vespa/vespalib/util/optimized.h> using vespalib::Optimized; using search::byte; @@ -12,6 +12,16 @@ namespace vsm { IMPLEMENT_DUPLICATE(FUTF8StrChrFieldSearcher); +FUTF8StrChrFieldSearcher::FUTF8StrChrFieldSearcher() + : UTF8StrChrFieldSearcher(), + _folded(4096) +{ } +FUTF8StrChrFieldSearcher::FUTF8StrChrFieldSearcher(FieldIdT fId) + : UTF8StrChrFieldSearcher(fId), + _folded(4096) +{ } +FUTF8StrChrFieldSearcher::~FUTF8StrChrFieldSearcher() {} + bool FUTF8StrChrFieldSearcher::ansiFold(const char * toFold, size_t sz, char * folded) { diff --git a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h index 4eb7f6c79b8..9e6ea72bcae 100644 --- a/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/futf8strchrfieldsearcher.h @@ -1,28 +1,26 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/fastlib/text/normwordfolder.h> -#include <vespa/vsm/searcher/utf8strchrfieldsearcher.h> +#include "utf8strchrfieldsearcher.h" -namespace vsm -{ +namespace vsm { class FUTF8StrChrFieldSearcher : public UTF8StrChrFieldSearcher { - public: - DUPLICATE(FUTF8StrChrFieldSearcher); - FUTF8StrChrFieldSearcher() : UTF8StrChrFieldSearcher(), _folded(4096) { } - FUTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StrChrFieldSearcher(fId), _folded(4096) { } - 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); +public: + DUPLICATE(FUTF8StrChrFieldSearcher); + FUTF8StrChrFieldSearcher(); + FUTF8StrChrFieldSearcher(FieldIdT fId); + ~FUTF8StrChrFieldSearcher(); + 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: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; - virtual size_t matchTerms(const FieldRef&, const size_t shortestTerm) override; - virtual size_t match(const char *folded, size_t sz, search::QueryTerm & qt); - size_t match(const char *folded, size_t sz, size_t mintsz, search::QueryTerm ** qtl, size_t qtlSize); - std::vector<char> _folded; + size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + size_t matchTerms(const FieldRef&, const size_t shortestTerm) override; + virtual size_t match(const char *folded, size_t sz, search::QueryTerm & qt); + size_t match(const char *folded, size_t sz, size_t mintsz, search::QueryTerm ** qtl, size_t qtlSize); + std::vector<char> _folded; }; } - diff --git a/vsm/src/vespa/vsm/searcher/intfieldsearcher.cpp b/vsm/src/vespa/vsm/searcher/intfieldsearcher.cpp index c5a45632903..eaa3110f821 100644 --- a/vsm/src/vespa/vsm/searcher/intfieldsearcher.cpp +++ b/vsm/src/vespa/vsm/searcher/intfieldsearcher.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "intfieldsearcher.h" -#include <vespa/document/fieldvalue/fieldvalue.h> using search::QueryTerm; using search::QueryTermList; @@ -14,6 +13,8 @@ IntFieldSearcher::IntFieldSearcher(FieldIdT fId) : _intTerm() { } +IntFieldSearcher::~IntFieldSearcher() {} + void IntFieldSearcher::prepare(QueryTermList & qtl, const SharedSearcherBuf & buf) { FieldSearcher::prepare(qtl, buf); diff --git a/vsm/src/vespa/vsm/searcher/intfieldsearcher.h b/vsm/src/vespa/vsm/searcher/intfieldsearcher.h index f023c5b39f2..53428cf1147 100644 --- a/vsm/src/vespa/vsm/searcher/intfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/intfieldsearcher.h @@ -1,18 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vsm/searcher/fieldsearcher.h> +#include "fieldsearcher.h" -namespace vsm -{ +namespace vsm { class IntFieldSearcher : public FieldSearcher { public: DUPLICATE(IntFieldSearcher); IntFieldSearcher(FieldIdT fId=0); - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; - virtual void onValue(const document::FieldValue & fv) override; + ~IntFieldSearcher(); + void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; + void onValue(const document::FieldValue & fv) override; protected: class IntInfo { diff --git a/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h index a7c4cbcce7a..b12f1c18a53 100644 --- a/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/strchrfieldsearcher.h @@ -1,24 +1,22 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vsm/searcher/fieldsearcher.h> +#include "fieldsearcher.h" -namespace vsm -{ +namespace vsm { class StrChrFieldSearcher : public FieldSearcher { - public: - StrChrFieldSearcher() : FieldSearcher(0) { } - StrChrFieldSearcher(FieldIdT fId) : FieldSearcher(fId) { } - virtual void onValue(const document::FieldValue & fv) override; - virtual void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; - private: - size_t shortestTerm() const; - bool matchDoc(const FieldRef & field); - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) = 0; - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) = 0; +public: + StrChrFieldSearcher() : FieldSearcher(0) { } + StrChrFieldSearcher(FieldIdT fId) : FieldSearcher(fId) { } + void onValue(const document::FieldValue & fv) override; + void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; +private: + size_t shortestTerm() const; + bool matchDoc(const FieldRef & field); + virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) = 0; + virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) = 0; }; } - diff --git a/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h b/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h index f6ba0d76e96..dfd5da9cb4e 100644 --- a/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h +++ b/vsm/src/vespa/vsm/searcher/utf8strchrfieldsearcher.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. 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 { @@ -17,8 +17,8 @@ public: UTF8StrChrFieldSearcher(FieldIdT fId) : UTF8StringFieldSearcherBase(fId) { } protected: - virtual size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; - virtual size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; + size_t matchTerm(const FieldRef & f, search::QueryTerm & qt) override; + size_t matchTerms(const FieldRef & f, const size_t shortestTerm) override; }; } diff --git a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp index 1ac019723e1..8e444102930 100644 --- a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp +++ b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.cpp @@ -1,6 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vsm/searcher/utf8stringfieldsearcherbase.h> +#include "utf8stringfieldsearcherbase.h" using search::QueryTerm; using search::QueryTermList; @@ -225,8 +225,6 @@ UTF8StringFieldSearcherBase::UTF8StringFieldSearcherBase() : { } - - UTF8StringFieldSearcherBase::UTF8StringFieldSearcherBase(FieldIdT fId) : StrChrFieldSearcher(fId), Fast_NormalizeWordFolder(), @@ -234,6 +232,8 @@ UTF8StringFieldSearcherBase::UTF8StringFieldSearcherBase(FieldIdT fId) : { } +UTF8StringFieldSearcherBase::~UTF8StringFieldSearcherBase() {} + void UTF8StringFieldSearcherBase::prepare(QueryTermList & qtl, const SharedSearcherBuf & buf) { diff --git a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h index a97511cd086..e0ca0687db6 100644 --- a/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h +++ b/vsm/src/vespa/vsm/searcher/utf8stringfieldsearcherbase.h @@ -1,7 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/vsm/searcher/strchrfieldsearcher.h> +#include "strchrfieldsearcher.h" #include <vespa/fastlib/text/normwordfolder.h> namespace vsm { @@ -106,6 +106,7 @@ protected: public: UTF8StringFieldSearcherBase(); UTF8StringFieldSearcherBase(FieldIdT fId); + ~UTF8StringFieldSearcherBase(); void prepare(search::QueryTermList & qtl, const SharedSearcherBuf & buf) override; /** * Matches the given query term against the given word using suffix match strategy. diff --git a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp index cc31a070d72..23e64d0bf5e 100644 --- a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp +++ b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.cpp @@ -133,5 +133,7 @@ UTF8SubstringSnippetModifier::UTF8SubstringSnippetModifier(FieldIdT fId, { } +UTF8SubstringSnippetModifier::~UTF8SubstringSnippetModifier() {} + } diff --git a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h index c77c8b7d824..3c27e0c9b53 100644 --- a/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h +++ b/vsm/src/vespa/vsm/searcher/utf8substringsnippetmodifier.h @@ -1,11 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "utf8stringfieldsearcherbase.h" #include <vespa/vsm/common/charbuffer.h> -#include <vespa/vsm/searcher/utf8stringfieldsearcherbase.h> -namespace vsm -{ +namespace vsm { typedef std::shared_ptr<std::vector<size_t> > SharedOffsetBuffer; @@ -54,6 +53,7 @@ public: UTF8SubstringSnippetModifier(); UTF8SubstringSnippetModifier(FieldIdT fId); + ~UTF8SubstringSnippetModifier(); /** * Creates a new instance. diff --git a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp index 4d36a58253d..cece6cce1b0 100644 --- a/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp +++ b/vsm/src/vespa/vsm/vsm/fieldsearchspec.cpp @@ -10,7 +10,6 @@ #include <vespa/vsm/searcher/intfieldsearcher.h> #include <vespa/vsm/searcher/floatfieldsearcher.h> #include <vespa/vespalib/util/regexp.h> -#include <sys/sysctl.h> #include <vespa/log/log.h> LOG_SETUP(".vsm.fieldsearchspec"); @@ -20,10 +19,7 @@ LOG_SETUP(".vsm.fieldsearchspec"); using search::Query; using search::ConstQueryTermList; -namespace vsm -{ - -unsigned FieldSearchSpec::_sse2WarnCount(0); +namespace vsm { FieldSearchSpec::FieldSearchSpec() : _id(0), @@ -35,6 +31,7 @@ FieldSearchSpec::FieldSearchSpec() : _reconfigured(false) { } +FieldSearchSpec::~FieldSearchSpec() {} FieldSearchSpec::FieldSearchSpec(const FieldIdT & fid, const vespalib::string & fname, VsmfieldsConfig::Fieldspec::Searchmethod searchDef, const vespalib::string & arg1, size_t maxLength_) : @@ -151,6 +148,8 @@ FieldSearchSpecMap::FieldSearchSpecMap() : _nameIdMap() { } +FieldSearchSpecMap::~FieldSearchSpecMap() {} + namespace { const vespalib::string _G_empty(""); const vespalib::string _G_value(".value"); diff --git a/vsm/src/vespa/vsm/vsm/fieldsearchspec.h b/vsm/src/vespa/vsm/vsm/fieldsearchspec.h index 3aec13aab55..dde79a5e6c8 100644 --- a/vsm/src/vespa/vsm/vsm/fieldsearchspec.h +++ b/vsm/src/vespa/vsm/vsm/fieldsearchspec.h @@ -4,8 +4,7 @@ #include <vespa/vsm/searcher/fieldsearcher.h> #include <vespa/vsm/config/vsm-cfif.h> -namespace vsm -{ +namespace vsm { class FieldSearchSpec { @@ -14,6 +13,7 @@ public: FieldSearchSpec(const FieldIdT & id, const vespalib::string & name, VsmfieldsConfig::Fieldspec::Searchmethod searchMethod, const vespalib::string & arg1, size_t maxLength); + ~FieldSearchSpec(); const FieldSearcher & searcher() const { return *_searcher; } const vespalib::string & name() const { return _name; } FieldIdT id() const { return _id; } @@ -35,7 +35,6 @@ private: VsmfieldsConfig::Fieldspec::Searchmethod _searchMethod; vespalib::string _arg1; bool _reconfigured; - static unsigned _sse2WarnCount; }; typedef std::map<FieldIdT, FieldSearchSpec> FieldSearchSpecMapT; @@ -44,6 +43,7 @@ class FieldSearchSpecMap { public: FieldSearchSpecMap(); + ~FieldSearchSpecMap(); /** * Iterates over all fields in the vsmfields config and creates a mapping from field id to FieldSearchSpec objects diff --git a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp index 4d394d47838..bccf8f8a843 100644 --- a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp +++ b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.cpp @@ -1,4 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "flattendocsumwriter.h" #include <vespa/document/fieldvalue/fieldvalues.h> @@ -37,4 +38,6 @@ FlattenDocsumWriter::FlattenDocsumWriter(const vespalib::string & separator) : _useSeparator(false) { } +FlattenDocsumWriter::~FlattenDocsumWriter() {} + } diff --git a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h index 8353caaf2d5..9c6ba8dae9c 100644 --- a/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h +++ b/vsm/src/vespa/vsm/vsm/flattendocsumwriter.h @@ -23,6 +23,7 @@ private: public: FlattenDocsumWriter(const vespalib::string & separator = " "); + ~FlattenDocsumWriter(); void setSeparator(const vespalib::string & separator) { _separator = separator; } const CharBuffer & getResult() const { return _output; } void clear() { diff --git a/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp b/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp index ddcb8376733..4d72bb598c6 100644 --- a/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp +++ b/vsm/src/vespa/vsm/vsm/snippetmodifier.cpp @@ -75,6 +75,8 @@ SnippetModifier::SnippetModifier(const UTF8SubstringSnippetModifier::SP & search { } +SnippetModifier::~SnippetModifier() {} + FieldValue::UP SnippetModifier::modify(const FieldValue & fv, const document::FieldPath & path) { @@ -93,6 +95,8 @@ SnippetModifierManager::SnippetModifierManager() : { } +SnippetModifierManager::~SnippetModifierManager() {} + void SnippetModifierManager::setup(const QueryTermList & queryTerms, const FieldSearchSpecMapT & specMap, diff --git a/vsm/src/vespa/vsm/vsm/snippetmodifier.h b/vsm/src/vespa/vsm/vsm/snippetmodifier.h index 148b2cc3ad8..17d6bb44d4c 100644 --- a/vsm/src/vespa/vsm/vsm/snippetmodifier.h +++ b/vsm/src/vespa/vsm/vsm/snippetmodifier.h @@ -51,6 +51,8 @@ public: **/ SnippetModifier(const UTF8SubstringSnippetModifier::SP & searcher, const CharBuffer::SP & valueBuf); + ~SnippetModifier(); + /** * Modifies the complete given field value. **/ @@ -90,6 +92,7 @@ private: public: SnippetModifierManager(); + ~SnippetModifierManager(); /** * Setups snippet modifiers for all fields where we have substring search. diff --git a/vsm/src/vespa/vsm/vsm/vsm-adapter.cpp b/vsm/src/vespa/vsm/vsm/vsm-adapter.cpp index b9b96691c90..fba4a0c8438 100644 --- a/vsm/src/vespa/vsm/vsm/vsm-adapter.cpp +++ b/vsm/src/vespa/vsm/vsm/vsm-adapter.cpp @@ -1,11 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vsm/vsm/vsm-adapter.h> -#include <vespa/vsm/vsm/docsumconfig.h> -#include <vespa/searchsummary/docsummary/keywordextractor.h> - -#include <vespa/config-summary.h> -#include <vespa/config-summarymap.h> +#include "vsm-adapter.h" +#include "docsumconfig.h" #include <vespa/log/log.h> LOG_SETUP(".vsm.vsm-adapter"); @@ -50,7 +46,7 @@ void GetDocsumsStateCallback::FillDocumentLocations(GetDocsumsState *state, IDoc } -GetDocsumsStateCallback::~GetDocsumsStateCallback(void) { } +GetDocsumsStateCallback::~GetDocsumsStateCallback() { } DocsumTools::FieldSpec::FieldSpec() : _outputName(), @@ -58,6 +54,8 @@ DocsumTools::FieldSpec::FieldSpec() : _command(VsmsummaryConfig::Fieldmap::NONE) { } +DocsumTools::FieldSpec::~FieldSpec() {} + DocsumTools::DocsumTools(std::unique_ptr<DynamicDocsumWriter> writer) : _writer(std::move(writer)), _juniper(), diff --git a/vsm/src/vespa/vsm/vsm/vsm-adapter.h b/vsm/src/vespa/vsm/vsm/vsm-adapter.h index 2ff8ada167e..7be0664d7c4 100644 --- a/vsm/src/vespa/vsm/vsm/vsm-adapter.h +++ b/vsm/src/vespa/vsm/vsm/vsm-adapter.h @@ -4,12 +4,9 @@ #pragma once -#include <time.h> #include <vespa/searchlib/query/base.h> #include <vespa/config/retriever/configsnapshot.h> #include <vespa/vsm/config/vsm-cfif.h> -#include <memory> -#include <vector> #include <vespa/config-summary.h> #include <vespa/config-summarymap.h> #include <vespa/searchlib/common/featureset.h> @@ -40,13 +37,13 @@ private: public: GetDocsumsStateCallback(); - virtual void FillSummaryFeatures(GetDocsumsState * state, IDocsumEnvironment * env); - virtual void FillRankFeatures(GetDocsumsState * state, IDocsumEnvironment * env); - virtual void ParseLocation(GetDocsumsState * state); + void FillSummaryFeatures(GetDocsumsState * state, IDocsumEnvironment * env) override; + void FillRankFeatures(GetDocsumsState * state, IDocsumEnvironment * env) override; + void ParseLocation(GetDocsumsState * state) override; virtual void FillDocumentLocations(GetDocsumsState * state, IDocsumEnvironment * env); void setSummaryFeatures(const search::FeatureSet::SP & sf) { _summaryFeatures = sf; } void setRankFeatures(const search::FeatureSet::SP & rf) { _rankFeatures = rf; } - virtual ~GetDocsumsStateCallback(void); + ~GetDocsumsStateCallback(); }; class DocsumTools : public IDocsumEnvironment @@ -60,6 +57,7 @@ public: public: FieldSpec(); + ~FieldSpec(); const vespalib::string & getOutputName() const { return _outputName; } void setOutputName(const vespalib::string & name) { _outputName = name; } const std::vector<vespalib::string> & getInputNames() const { return _inputNames; } @@ -87,9 +85,9 @@ public: bool obtainFieldNames(const FastS_VsmsummaryHandle &cfg); // inherit doc from IDocsumEnvironment - virtual search::IAttributeManager * getAttributeManager() { return NULL; } - virtual vespalib::string lookupIndex(const vespalib::string&) const { return ""; } - virtual juniper::Juniper * getJuniper() { return _juniper.get(); } + search::IAttributeManager * getAttributeManager() override { return NULL; } + vespalib::string lookupIndex(const vespalib::string&) const override { return ""; } + juniper::Juniper * getJuniper() override { return _juniper.get(); } }; typedef std::shared_ptr<DocsumTools> DocsumToolsPtr; |