diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-05-03 09:53:14 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-05-03 09:53:14 +0200 |
commit | cf8fd2ac8a5ad6c4a76bd034d341b6db1972b0ae (patch) | |
tree | 7e4b66e8a378ad3dc4a1b93cbf6de3f932d6dd8e | |
parent | 3cd9c747e62ee82edfb5fedf4415f5daa45b3ab3 (diff) |
Fix warnings hidden earlier due to including application headers as system includes
132 files changed, 828 insertions, 1114 deletions
diff --git a/searchlib/src/vespa/searchlib/aggregation/aggregation.cpp b/searchlib/src/vespa/searchlib/aggregation/aggregation.cpp index 45224242e32..1cfc9804390 100644 --- a/searchlib/src/vespa/searchlib/aggregation/aggregation.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/aggregation.cpp @@ -239,6 +239,8 @@ void MinAggregationResult::onReset() _min->setMax(); } +AverageAggregationResult::~AverageAggregationResult() {} + void AverageAggregationResult::onMerge(const AggregationResult & b) { const AverageAggregationResult & avg(static_cast<const AverageAggregationResult &>(b)); @@ -350,6 +352,16 @@ Deserializer & SumAggregationResult::onDeserialize(Deserializer & is) return is >> _sum; } +SumAggregationResult::SumAggregationResult() + : AggregationResult(), + _sum() +{ } +SumAggregationResult::SumAggregationResult(SingleResultNode::UP sum) + : AggregationResult(), + _sum(sum.release()) +{ } +SumAggregationResult::~SumAggregationResult() {} + void SumAggregationResult::visitMembers(vespalib::ObjectVisitor &visitor) const { @@ -485,6 +497,10 @@ Deserializer &ExpressionCountAggregationResult::onDeserialize( _rank.set(calculateRank(_hll.getSketch())); return is; } + +ExpressionCountAggregationResult::ExpressionCountAggregationResult() : AggregationResult(), _hll() { } +ExpressionCountAggregationResult::~ExpressionCountAggregationResult() {} + } // namespace aggregation } // namespace search diff --git a/searchlib/src/vespa/searchlib/aggregation/averageaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/averageaggregationresult.h index be81512961e..b1f054fd791 100644 --- a/searchlib/src/vespa/searchlib/aggregation/averageaggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/averageaggregationresult.h @@ -4,7 +4,6 @@ #include "aggregationresult.h" #include <vespa/searchlib/expression/numericresultnode.h> - namespace search { namespace aggregation { @@ -14,13 +13,14 @@ public: using NumericResultNode = expression::NumericResultNode; DECLARE_AGGREGATIONRESULT(AverageAggregationResult); AverageAggregationResult() : _sum(), _count(0) {} - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + ~AverageAggregationResult(); + void visitMembers(vespalib::ObjectVisitor &visitor) const override; const NumericResultNode & getAverage() const; const NumericResultNode & getSum() const { return *_sum; } uint64_t getCount() const { return _count; } private: - virtual const ResultNode & onGetRank() const { return getAverage(); } - virtual void onPrepare(const ResultNode & result, bool useForInit); + const ResultNode & onGetRank() const override { return getAverage(); } + void onPrepare(const ResultNode & result, bool useForInit) override; NumericResultNode::CP _sum; uint64_t _count; mutable NumericResultNode::CP _averageScratchPad; diff --git a/searchlib/src/vespa/searchlib/aggregation/expressioncountaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/expressioncountaggregationresult.h index 5e55c146660..99e0e71685a 100644 --- a/searchlib/src/vespa/searchlib/aggregation/expressioncountaggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/expressioncountaggregationresult.h @@ -25,7 +25,8 @@ class ExpressionCountAggregationResult : public AggregationResult { void onPrepare(const ResultNode &, bool) override { } public: DECLARE_AGGREGATIONRESULT(ExpressionCountAggregationResult); - ExpressionCountAggregationResult() : AggregationResult(), _hll() { } + ExpressionCountAggregationResult(); + ~ExpressionCountAggregationResult(); void visitMembers(vespalib::ObjectVisitor &) const override {} const Sketch<PRECISION, uint32_t> &getSketch() const { return _hll.getSketch(); } diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp index e0ea82560f7..1e3c33cdbd3 100644 --- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp +++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp @@ -6,8 +6,7 @@ #include <vespa/log/log.h> LOG_SETUP(".searchlib.aggregation.hitsaggregationresult"); -namespace search { -namespace aggregation { +namespace search::aggregation { using vespalib::FieldBase; using vespalib::Serializer; @@ -15,6 +14,17 @@ using vespalib::Deserializer; IMPLEMENT_IDENTIFIABLE_NS2(search, aggregation, HitsAggregationResult, AggregationResult); +HitsAggregationResult::HitsAggregationResult() : + AggregationResult(), + _summaryClass("default"), + _maxHits(std::numeric_limits<uint32_t>::max()), + _hits(), + _isOrdered(false), + _bestHitRank(), + _summaryGenerator(0) +{} +HitsAggregationResult::~HitsAggregationResult() {} + void HitsAggregationResult::onPrepare(const ResultNode & result, bool useForInit) { (void) result; @@ -111,7 +121,6 @@ HitsAggregationResult::onGetRank() const } } -} // this function was added by ../../forcelink.sh void forcelink_file_searchlib_aggregation_hitsaggregationresult() {} diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h index 11565c21ca2..8c62c957ffd 100644 --- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h @@ -5,8 +5,7 @@ #include "hitlist.h" #include <vespa/searchlib/expression/floatresultnode.h> -namespace search { -namespace aggregation { +namespace search::aggregation { class HitsAggregationResult : public AggregationResult { @@ -43,15 +42,8 @@ public: }; DECLARE_AGGREGATIONRESULT(HitsAggregationResult); - HitsAggregationResult() : - AggregationResult(), - _summaryClass("default"), - _maxHits(std::numeric_limits<uint32_t>::max()), - _hits(), - _isOrdered(false), - _bestHitRank(), - _summaryGenerator(0) - {} + HitsAggregationResult(); + ~HitsAggregationResult(); void postMerge() override { _hits.postMerge(_maxHits); } void setSummaryGenerator(SummaryGenerator & summaryGenerator) { _summaryGenerator = &summaryGenerator; } const SummaryClassType & getSummaryClass() const { return _summaryClass; } @@ -70,5 +62,3 @@ public: }; } -} - diff --git a/searchlib/src/vespa/searchlib/aggregation/predicates.h b/searchlib/src/vespa/searchlib/aggregation/predicates.h index c6ef6bc554a..e39c776cf29 100644 --- a/searchlib/src/vespa/searchlib/aggregation/predicates.h +++ b/searchlib/src/vespa/searchlib/aggregation/predicates.h @@ -17,10 +17,10 @@ private: public: CountFS4Hits() : _hitCnt(0) {} uint32_t getHitCount() const { return _hitCnt; } - virtual bool check(const vespalib::Identifiable &obj) const { + bool check(const vespalib::Identifiable &obj) const override { return (obj.getClass().id() == FS4Hit::classId); } - virtual void execute(vespalib::Identifiable &obj) { + void execute(vespalib::Identifiable &obj) override { (void) obj; ++_hitCnt; } @@ -34,10 +34,10 @@ private: public: FS4HitSetDistributionKey(uint32_t distributionKey) : _distributionKey(distributionKey) {} - virtual bool check(const vespalib::Identifiable &obj) const { + bool check(const vespalib::Identifiable &obj) const override { return (obj.getClass().id() == FS4Hit::classId); } - virtual void execute(vespalib::Identifiable &obj) { + void execute(vespalib::Identifiable &obj) override { static_cast<FS4Hit &>(obj).setDistributionKey(_distributionKey); } }; diff --git a/searchlib/src/vespa/searchlib/aggregation/sumaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/sumaggregationresult.h index 0916dc75ff9..8a772d8b282 100644 --- a/searchlib/src/vespa/searchlib/aggregation/sumaggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/sumaggregationresult.h @@ -4,24 +4,22 @@ #include "aggregationresult.h" #include <vespa/searchlib/expression/singleresultnode.h> - -namespace search { -namespace aggregation { +namespace search::aggregation { class SumAggregationResult : public AggregationResult { public: using SingleResultNode = expression::SingleResultNode; DECLARE_AGGREGATIONRESULT(SumAggregationResult); - SumAggregationResult() : AggregationResult(), _sum() { } - SumAggregationResult(SingleResultNode::UP sum) : AggregationResult(), _sum(sum.release()) { } - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + SumAggregationResult(); + SumAggregationResult(SingleResultNode::UP sum); + ~SumAggregationResult(); + void visitMembers(vespalib::ObjectVisitor &visitor) const override; const SingleResultNode & getSum() const { return *_sum; } private: - virtual const ResultNode & onGetRank() const { return getSum(); } - virtual void onPrepare(const ResultNode & result, bool useForInit); + const ResultNode & onGetRank() const override { return getSum(); } + void onPrepare(const ResultNode & result, bool useForInit) override; SingleResultNode::CP _sum; }; } -} diff --git a/searchlib/src/vespa/searchlib/aggregation/xoraggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/xoraggregationresult.h index 9c8b0e9c2c7..d1a033fba91 100644 --- a/searchlib/src/vespa/searchlib/aggregation/xoraggregationresult.h +++ b/searchlib/src/vespa/searchlib/aggregation/xoraggregationresult.h @@ -4,7 +4,6 @@ #include "aggregationresult.h" #include <vespa/searchlib/expression/integerresultnode.h> - namespace search { namespace aggregation { @@ -13,15 +12,15 @@ class XorAggregationResult : public AggregationResult public: using Int64ResultNode = expression::Int64ResultNode; DECLARE_AGGREGATIONRESULT(XorAggregationResult); - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + void visitMembers(vespalib::ObjectVisitor &visitor) const override; const Int64ResultNode & getXor() const { return _xor; } XorAggregationResult &setXor(const Int64ResultNode &i) { _xor = i; return *this; } private: - virtual const ResultNode & onGetRank() const { return getXor(); } - virtual void onPrepare(const ResultNode & result, bool useForInit); + const ResultNode & onGetRank() const override { return getXor(); } + void onPrepare(const ResultNode & result, bool useForInit) override; Int64ResultNode _xor; }; diff --git a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp index 8779b850886..4f5986d1214 100644 --- a/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attribute_blueprint_factory.cpp @@ -18,9 +18,15 @@ #include <vespa/searchlib/queryeval/intermediate_blueprints.h> #include <vespa/searchlib/queryeval/leaf_blueprints.h> #include <vespa/searchlib/queryeval/orlikesearch.h> +#include <vespa/searchlib/queryeval/dot_product_blueprint.h> +#include <vespa/searchlib/queryeval/wand/parallel_weak_and_blueprint.h> #include <vespa/searchlib/queryeval/predicate_blueprint.h> #include <vespa/searchlib/queryeval/wand/parallel_weak_and_search.h> #include <vespa/searchlib/queryeval/weighted_set_term_search.h> +#include <vespa/searchlib/queryeval/weighted_set_term_blueprint.h> +#include <vespa/searchlib/queryeval/get_weight_from_node.h> + + #include <vespa/vespalib/util/regexp.h> #include <sstream> diff --git a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp index 219ef2221f2..1034739863f 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attributeiterators.hpp @@ -269,6 +269,7 @@ FlagAttributeIteratorT<SC>::doSeek(uint32_t docId) template <typename SC> void FlagAttributeIteratorT<SC>::or_hits_into(BitVector &result, uint32_t begin_id) { + (void) begin_id; const SC & sc(_sc); const typename SC::Attribute &attr = static_cast<const typename SC::Attribute &>(sc.attribute()); for (int i = sc._low; (i <= sc._high); ++i) { diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.cpp b/searchlib/src/vespa/searchlib/attribute/attrvector.cpp index b59b3aa81d2..83d3927f23c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.cpp @@ -1,16 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> #include "attrvector.h" #include "attrvector.hpp" -#include <vespa/fastlib/io/bufferedfile.h> -#include <vespa/searchlib/attribute/attrvector.h> -#include <vespa/searchlib/util/filekit.h> #include "iattributesavetarget.h" -LOG_SETUP(".attrvector"); - namespace search { StringDirectAttribute:: @@ -22,6 +15,8 @@ StringDirectAttribute(const vespalib::string & baseFileName, const Config & c) { } +StringDirectAttribute::~StringDirectAttribute() {} + bool StringDirectAttribute::findEnum(const char * key, EnumHandle & e) const { if (_offsets.size() < 1) { diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.h b/searchlib/src/vespa/searchlib/attribute/attrvector.h index 75ff02563f4..4cf2d1df78a 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.h +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.h @@ -1,10 +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 "stringbase.h" +#include "integerbase.h" +#include "floatbase.h" #include <vespa/searchlib/common/rankedhit.h> -#include <vespa/searchlib/attribute/stringbase.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> //TODO: This one should go. // @@ -32,9 +32,9 @@ private: typedef typename B::EnumHandle EnumHandle; NumericDirectAttribute(const NumericDirectAttribute &); NumericDirectAttribute & operator=(const NumericDirectAttribute &); - virtual bool onLoad(); - virtual typename B::BaseType getFromEnum(EnumHandle e) const { return _data[e]; } - virtual void getEnumValue(const EnumHandle * v, uint32_t *e, uint32_t sz) const { + bool onLoad() override; + typename B::BaseType getFromEnum(EnumHandle e) const override { return _data[e]; } + void getEnumValue(const EnumHandle * v, uint32_t *e, uint32_t sz) const override { for (size_t i(0); i < sz; i++) { e[i] = v[i]; } @@ -47,11 +47,12 @@ protected: typedef typename B::Config Config; NumericDirectAttribute(const vespalib::string & baseFileName, const Config & c); + ~NumericDirectAttribute(); - virtual bool findEnum(BaseType value, EnumHandle & e) const; - virtual void onCommit(); - virtual void onUpdateStat() { } - virtual bool addDoc(DocId & ); + bool findEnum(BaseType value, EnumHandle & e) const override; + void onCommit() override; + void onUpdateStat() override { } + bool addDoc(DocId & ) override; std::vector<BaseType> _data; std::vector<uint32_t> _idx; @@ -70,10 +71,10 @@ private: public: NumericDirectAttrVector(const vespalib::string & baseFileName); NumericDirectAttrVector(const vespalib::string & baseFileName, const AttributeVector::Config & c); - virtual largeint_t getInt(DocId doc) const { return static_cast<largeint_t>(getHelper(doc, 0)); } - virtual double getFloat(DocId doc) const { return getHelper(doc, 0); } - virtual uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const { return getAllHelper<largeint_t, largeint_t>(doc, v, sz); } - virtual uint32_t get(DocId doc, double * v, uint32_t sz) const { return getAllHelper<double, double>(doc, v, sz); } + largeint_t getInt(DocId doc) const override { return static_cast<largeint_t>(getHelper(doc, 0)); } + double getFloat(DocId doc) const override { return getHelper(doc, 0); } + uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { return getAllHelper<largeint_t, largeint_t>(doc, v, sz); } + uint32_t get(DocId doc, double * v, uint32_t sz) const override { return getAllHelper<double, double>(doc, v, sz); } private: typedef typename B::EnumHandle EnumHandle; typedef typename B::BaseType BaseType; @@ -81,13 +82,13 @@ private: typedef typename B::WeightedEnum WeightedEnum; typedef typename B::WeightedInt WeightedInt; typedef typename B::WeightedFloat WeightedFloat; - virtual BaseType get(DocId doc) const { return getHelper(doc, 0); } - virtual EnumHandle getEnum(DocId doc) const { return getEnumHelper(doc, 0); } - virtual uint32_t getAll(DocId doc, BaseType * v, uint32_t sz) const { return getAllHelper<BaseType, BaseType>(doc, v, sz); } - virtual uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const { return getAllEnumHelper(doc, e, sz); } + BaseType get(DocId doc) const override { return getHelper(doc, 0); } + EnumHandle getEnum(DocId doc) const override { return getEnumHelper(doc, 0); } + uint32_t getAll(DocId doc, BaseType * v, uint32_t sz) const override { return getAllHelper<BaseType, BaseType>(doc, v, sz); } + uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const override { return getAllEnumHelper(doc, e, sz); } - virtual uint32_t getValueCount(DocId doc) const { return getValueCountHelper(doc); } - virtual bool hasEnum2Value() const { return false; } + uint32_t getValueCount(DocId doc) const override { return getValueCountHelper(doc); } + bool hasEnum2Value() const override { return false; } uint32_t getValueCountHelper(DocId doc) const { if (F::IsMultiValue()) { @@ -129,10 +130,10 @@ private: return available; } - virtual uint32_t get(DocId doc, WeightedEnum * v, uint32_t sz) const { return getAllEnumHelper(doc, v, sz); } - virtual uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const { return getAllHelper<Weighted, BaseType>(doc, v, sz); } - virtual uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const { return getAllHelper<WeightedInt, largeint_t>(doc, v, sz); } - virtual uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const { return getAllHelper<WeightedFloat, double>(doc, v, sz); } + uint32_t get(DocId doc, WeightedEnum * v, uint32_t sz) const override { return getAllEnumHelper(doc, v, sz); } + uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { return getAllHelper<Weighted, BaseType>(doc, v, sz); } + uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { return getAllHelper<WeightedInt, largeint_t>(doc, v, sz); } + uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const override { return getAllHelper<WeightedFloat, double>(doc, v, sz); } }; //----------------------------------------------------------------------------- @@ -148,6 +149,7 @@ private: const char * getFromEnum(EnumHandle e) const override { return &_buffer[e]; } protected: StringDirectAttribute(const vespalib::string & baseFileName, const Config & c); + ~StringDirectAttribute(); bool findEnum(const char * value, EnumHandle & e) const override; void getEnumValue(const EnumHandle * v, uint32_t *e, uint32_t sz) const override { for (size_t i(0); i < sz; i++) { @@ -173,18 +175,22 @@ class StringDirectAttrVector : public search::StringDirectAttribute public: StringDirectAttrVector(const vespalib::string & baseFileName); StringDirectAttrVector(const vespalib::string & baseFileName, const Config & c); - virtual const char * getString(DocId doc, char * v, size_t sz) const { (void) v; (void) sz; return getHelper(doc, 0); } - virtual uint32_t get(DocId doc, const char ** v, uint32_t sz) const { return getAllHelper(doc, v, sz); } + const char * getString(DocId doc, char * v, size_t sz) const override { + (void) v; (void) sz; return getHelper(doc, 0); + } + uint32_t get(DocId doc, const char ** v, uint32_t sz) const override { + return getAllHelper(doc, v, sz); + } private: - virtual uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const { return getAllHelper(doc, v, sz); } - virtual uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const { return getAllEnumHelper(doc, e, sz); } - virtual const char * get(DocId doc) const { return getHelper(doc, 0); } - virtual EnumHandle getEnum(DocId doc) const { return getEnumHelper(doc, 0); } - virtual uint32_t getValueCount(DocId doc) const { return getValueCountHelper(doc); } - virtual uint32_t get(DocId doc, WeightedEnum * e, uint32_t sz) const { return getAllEnumHelper(doc, e, sz); } - virtual uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const { return getAllHelper(doc, v, sz); } - virtual uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const { return getAllHelper(doc, v, sz); } - virtual bool hasEnum2Value() const { return true; } + uint32_t get(DocId doc, vespalib::string * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } + uint32_t get(DocId doc, EnumHandle * e, uint32_t sz) const override { return getAllEnumHelper(doc, e, sz); } + const char * get(DocId doc) const override { return getHelper(doc, 0); } + EnumHandle getEnum(DocId doc) const override { return getEnumHelper(doc, 0); } + uint32_t getValueCount(DocId doc) const override { return getValueCountHelper(doc); } + uint32_t get(DocId doc, WeightedEnum * e, uint32_t sz) const override { return getAllEnumHelper(doc, e, sz); } + uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } + uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override { return getAllHelper(doc, v, sz); } + bool hasEnum2Value() const override { return true; } uint32_t getValueCountHelper(DocId doc) const { if (F::IsMultiValue()) { diff --git a/searchlib/src/vespa/searchlib/attribute/attrvector.hpp b/searchlib/src/vespa/searchlib/attribute/attrvector.hpp index c5546e529fd..fe067f3e324 100644 --- a/searchlib/src/vespa/searchlib/attribute/attrvector.hpp +++ b/searchlib/src/vespa/searchlib/attribute/attrvector.hpp @@ -1,8 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "attrvector.h" #include <vespa/fastlib/io/bufferedfile.h> -#include <vespa/searchlib/attribute/attrvector.h> #include <vespa/searchlib/util/filekit.h> namespace search { @@ -17,6 +17,9 @@ NumericDirectAttribute(const vespalib::string & baseFileName, const Config & c) } template <typename B> +NumericDirectAttribute<B>::~NumericDirectAttribute() {} + +template <typename B> bool NumericDirectAttribute<B>::onLoad() { fileutil::LoadedBuffer::UP dataBuffer(B::loadDAT()); diff --git a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp index e79e6de51b7..7249dd9ae8c 100644 --- a/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createarrayfastsearch.cpp @@ -1,23 +1,22 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> -#include <vespa/searchlib/attribute/flagattribute.h> +#include "attributefactory.h" +#include "integerbase.h" +#include "floatbase.h" +#include "flagattribute.h" #include "defines.h" #include <vespa/log/log.h> LOG_SETUP(".createarrayfastsearch"); -#include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/attribute/enumstore.hpp> -#include <vespa/searchlib/attribute/enumattribute.hpp> -#include <vespa/searchlib/attribute/multivalueattribute.hpp> -#include <vespa/searchlib/attribute/multienumattribute.hpp> -#include <vespa/searchlib/attribute/multinumericenumattribute.hpp> -#include <vespa/searchlib/attribute/multinumericpostattribute.hpp> -#include <vespa/searchlib/attribute/multistringpostattribute.hpp> +#include "attributevector.hpp" +#include "enumstore.hpp" +#include "enumattribute.hpp" +#include "multivalueattribute.hpp" +#include "multienumattribute.hpp" +#include "multinumericenumattribute.hpp" +#include "multinumericpostattribute.hpp" +#include "multistringpostattribute.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp index 31446b3be37..f38b974b35d 100644 --- a/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp +++ b/searchlib/src/vespa/searchlib/attribute/createsetfastsearch.cpp @@ -1,23 +1,21 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> +#include "attributefactory.h" +#include "integerbase.h" +#include "floatbase.h" #include "defines.h" #include <vespa/log/log.h> LOG_SETUP(".createsetfastsearch"); - -#include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/attribute/enumstore.hpp> -#include <vespa/searchlib/attribute/enumattribute.hpp> -#include <vespa/searchlib/attribute/multivalueattribute.hpp> -#include <vespa/searchlib/attribute/multienumattribute.hpp> -#include <vespa/searchlib/attribute/multinumericenumattribute.hpp> -#include <vespa/searchlib/attribute/multinumericpostattribute.hpp> -#include <vespa/searchlib/attribute/multistringpostattribute.hpp> +#include "attributevector.hpp" +#include "enumstore.hpp" +#include "enumattribute.hpp" +#include "multivalueattribute.hpp" +#include "multienumattribute.hpp" +#include "multinumericenumattribute.hpp" +#include "multinumericpostattribute.hpp" +#include "multistringpostattribute.hpp" namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.h b/searchlib/src/vespa/searchlib/attribute/enumattribute.h index ca5058c71d3..ad5e833d3a1 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.h @@ -4,13 +4,12 @@ #include "attributevector.h" #include "loadedenumvalue.h" -#include <vespa/searchlib/attribute/enumstore.h> +#include "enumstore.h" #include <set> namespace search { -namespace attribute -{ +namespace attribute { template <typename, typename, typename > class PostingSearchContext; @@ -56,11 +55,11 @@ protected: EnumStore & getEnumStore() { return _enumStore; } const EnumStore & getEnumStore() const { return _enumStore; } - virtual const EnumStoreBase * getEnumStoreBase() const { return &_enumStore; } - virtual void getEnumValue(const EnumHandle * v, uint32_t *e, uint32_t sz) const { _enumStore.getEnumValue(v, e, sz); } - virtual EnumType getFromEnum(EnumHandle e) const { return _enumStore.getValue(e); } + const EnumStoreBase * getEnumStoreBase() const override { return &_enumStore; } + void getEnumValue(const EnumHandle * v, uint32_t *e, uint32_t sz) const override { _enumStore.getEnumValue(v, e, sz); } + EnumType getFromEnum(EnumHandle e) const override { return _enumStore.getValue(e); } - virtual void fillPostings(LoadedVector & loaded) { (void) loaded; } + void fillPostings(LoadedVector & loaded) override { (void) loaded; } void fillEnum(LoadedVector & loaded) override; void fillEnum0(const void *src, size_t srcLen, EnumIndexVector &eidxs) override; void fixupEnumRefCounts(const EnumVector &enumHist) override; @@ -75,15 +74,13 @@ protected: void insertNewUniqueValues(EnumStoreBase::IndexVector & newIndexes); virtual void considerAttributeChange(const Change & c, UniqueSet & newUniques) = 0; virtual void reEnumerate() = 0; - virtual bool hasEnum2Value() const { return true; } - virtual AddressSpace getEnumStoreAddressSpaceUsage() const override; + bool hasEnum2Value() const override { return true; } + AddressSpace getEnumStoreAddressSpaceUsage() const override; public: - EnumAttribute(const vespalib::string & baseFileName, - const AttributeVector::Config & cfg); - + EnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); ~EnumAttribute(); - virtual bool findEnum(EnumType v, EnumHandle & e) const { return _enumStore.findEnum(v, e); } + bool findEnum(EnumType v, EnumHandle & e) const override { return _enumStore.findEnum(v, e); } }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp index ae011bbcb0a..39b8b356100 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.cpp @@ -1,8 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "extendableattributes.h" -#include <vespa/searchlib/attribute/attrvector.hpp> +#include "attrvector.hpp" namespace search { @@ -88,6 +87,8 @@ WeightedSetIntegerExtAttribute::WeightedSetIntegerExtAttribute(const vespalib::s { } +WeightedSetIntegerExtAttribute::~WeightedSetIntegerExtAttribute() {} + bool WeightedSetIntegerExtAttribute::add(int64_t v, int32_t w) { @@ -112,6 +113,8 @@ WeightedSetFloatExtAttribute::WeightedSetFloatExtAttribute(const vespalib::strin { } +WeightedSetFloatExtAttribute::~WeightedSetFloatExtAttribute() {} + bool WeightedSetFloatExtAttribute::add(double v, int32_t w) { @@ -138,6 +141,8 @@ WeightedSetStringExtAttribute::WeightedSetStringExtAttribute(const vespalib::str setSortedEnum(false); } +WeightedSetStringExtAttribute::~WeightedSetStringExtAttribute() {} + bool WeightedSetStringExtAttribute::add(const char * v, int32_t w) { @@ -158,5 +163,4 @@ WeightedSetStringExtAttribute::get(DocId doc, AttributeVector::WeightedConstChar return getAllHelper(doc, v, sz); } - } diff --git a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h index b98246b174d..98b0a90f8e6 100644 --- a/searchlib/src/vespa/searchlib/attribute/extendableattributes.h +++ b/searchlib/src/vespa/searchlib/attribute/extendableattributes.h @@ -6,8 +6,8 @@ */ #pragma once -#include <vespa/searchlib/attribute/attrvector.h> -#include <vespa/searchlib/attribute/attrvector.hpp> +#include "attrvector.h" +#include "attrvector.hpp" namespace search { @@ -192,8 +192,8 @@ protected: WeightedSetExtAttributeBase(const vespalib::string & name) : B(name, attribute::CollectionType::WSET), _weights() - { - } + {} + ~WeightedSetExtAttributeBase() {} }; class WeightedSetIntegerExtAttribute @@ -208,6 +208,7 @@ class WeightedSetIntegerExtAttribute } public: WeightedSetIntegerExtAttribute(const vespalib::string & name); + ~WeightedSetIntegerExtAttribute(); bool add(int64_t v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedInt * v, uint32_t sz) const override; }; @@ -224,6 +225,7 @@ class WeightedSetFloatExtAttribute } public: WeightedSetFloatExtAttribute(const vespalib::string & name); + ~WeightedSetFloatExtAttribute(); bool add(double v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedFloat * v, uint32_t sz) const override; }; @@ -248,6 +250,7 @@ private: public: WeightedSetStringExtAttribute(const vespalib::string & name); + ~WeightedSetStringExtAttribute(); bool add(const char * v, int32_t w = 1) override; uint32_t get(DocId doc, AttributeVector::WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, AttributeVector::WeightedConstChar * v, uint32_t sz) const override; diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index 648d9459442..30d85de78f6 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -75,6 +75,7 @@ protected: virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void fillEnum(LoadedVector&) {} virtual void fillValues(LoadedVector &) {} + virtual void fillPostings(LoadedVector &) {} largeint_t getDefaultValue() const override { return static_cast<largeint_t>(-std::numeric_limits<T>::max()); } Change _defaultValue; @@ -90,4 +91,3 @@ private: }; } - diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index 238b3dd8efd..f4a97e02aec 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -91,6 +91,7 @@ protected: virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void fillEnum(LoadedVector&) {} virtual void fillValues(LoadedVector &) {} + virtual void fillPostings(LoadedVector &) {} largeint_t getDefaultValue() const override { return defaultValue(); } bool isUndefined(DocId doc) const override { return get(doc) == defaultValue(); } diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h index f2f808c0182..3b5201f804e 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericenumattribute.h @@ -157,7 +157,7 @@ protected: public: MultiValueNumericEnumAttribute(const vespalib::string & baseFileName, const AttributeVector::Config & cfg); - virtual bool onLoad(); + bool onLoad() override; bool onLoadEnumerated(ReaderBase &attrReader); @@ -167,7 +167,7 @@ public: //------------------------------------------------------------------------- // Attribute read API //------------------------------------------------------------------------- - virtual T get(DocId doc) const { + T get(DocId doc) const override { WeightedIndexArrayRef indices(this->_mvMapping.get(doc)); if (indices.size() == 0) { return T(); @@ -175,10 +175,10 @@ public: return this->_enumStore.getValue(indices[0].value()); } } - virtual largeint_t getInt(DocId doc) const { + largeint_t getInt(DocId doc) const override { return static_cast<largeint_t>(get(doc)); } - virtual double getFloat(DocId doc) const { + double getFloat(DocId doc) const override { return static_cast<double>(get(doc)); } @@ -191,13 +191,13 @@ public: } return valueCount; } - virtual uint32_t getAll(DocId doc, T * v, uint32_t sz) const { + uint32_t getAll(DocId doc, T * v, uint32_t sz) const override { return getHelper(doc, v, sz); } - virtual uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const { + uint32_t get(DocId doc, largeint_t * v, uint32_t sz) const override { return getHelper(doc, v, sz); } - virtual uint32_t get(DocId doc, double * v, uint32_t sz) const { + uint32_t get(DocId doc, double * v, uint32_t sz) const override { return getHelper(doc, v, sz); } @@ -210,13 +210,13 @@ public: } return valueCount; } - virtual uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const { + uint32_t getAll(DocId doc, Weighted * v, uint32_t sz) const override { return getWeightedHelper<Weighted, T>(doc, v, sz); } - virtual uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const { + uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override { return getWeightedHelper<WeightedInt, largeint_t>(doc, v, sz); } - virtual uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const { + uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const override { return getWeightedHelper<WeightedFloat, double>(doc, v, sz); } @@ -226,4 +226,3 @@ private: }; } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h index 2ee03c6a64b..a867086a357 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.h @@ -76,35 +76,35 @@ private: using PostingParent::fillPostingsFixupEnumBase; using PostingParent::forwardedOnAddDoc; - virtual void freezeEnumDictionary(); - virtual void mergeMemoryStats(MemoryUsage & total); - virtual void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused); + void freezeEnumDictionary() override; + void mergeMemoryStats(MemoryUsage & total) override; + void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused) override; public: MultiValueNumericPostingAttribute(const vespalib::string & name, const AttributeVector::Config & cfg); - virtual~MultiValueNumericPostingAttribute(); + ~MultiValueNumericPostingAttribute(); - virtual void removeOldGenerations(generation_t firstUsed); - virtual void onGenerationChange(generation_t generation); + void removeOldGenerations(generation_t firstUsed) override; + void onGenerationChange(generation_t generation) override; AttributeVector::SearchContext::UP getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; - virtual const IDocumentWeightAttribute *asDocumentWeightAttribute() const override; + const IDocumentWeightAttribute *asDocumentWeightAttribute() const override; - virtual bool onAddDoc(DocId doc) { + bool onAddDoc(DocId doc) override { return forwardedOnAddDoc(doc, this->_mvMapping.getNumKeys(), this->_mvMapping.getCapacityKeys()); } - virtual void fillPostings(LoadedVector & loaded) { + void fillPostings(LoadedVector & loaded) override { handleFillPostings(loaded); } - virtual attribute::IPostingListAttributeBase *getIPostingListAttributeBase() { + attribute::IPostingListAttributeBase *getIPostingListAttributeBase() override { return this; } - virtual void fillPostingsFixupEnum(const LoadedEnumAttributeVector &loaded) { + void fillPostingsFixupEnum(const LoadedEnumAttributeVector &loaded) override { fillPostingsFixupEnumBase(loaded); } }; diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp index a02df1b6ece..365ec8e9981 100644 --- a/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multinumericpostattribute.hpp @@ -2,7 +2,7 @@ #pragma once -#include <vespa/searchlib/attribute/multinumericpostattribute.h> +#include "multinumericpostattribute.h" namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h index 8b773ca3545..3de4d21e6d0 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.h @@ -2,8 +2,8 @@ #pragma once -#include <vespa/searchlib/attribute/multistringattribute.h> -#include <vespa/searchlib/attribute/postinglistattribute.h> +#include "multistringattribute.h" +#include "postinglistattribute.h" #include "i_document_weight_attribute.h" namespace search { @@ -77,9 +77,9 @@ private: using PostingParent::fillPostingsFixupEnumBase; using PostingParent::forwardedOnAddDoc; - virtual void freezeEnumDictionary(); - virtual void mergeMemoryStats(MemoryUsage & total); - virtual void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused); + void freezeEnumDictionary() override; + void mergeMemoryStats(MemoryUsage & total) override; + void applyValueChanges(const DocIndices & docIndices, EnumStoreBase::IndexVector & unused) override ; public: MultiValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c = diff --git a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp index eb2eb692202..d4ee8aeb04e 100644 --- a/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/multistringpostattribute.hpp @@ -8,7 +8,6 @@ #include <vespa/fastlib/io/bufferedfile.h> #include <vespa/searchlib/query/queryterm.h> - namespace search { template <typename B, typename T> diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h index 21267fe1d38..d59663edfe0 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.h @@ -125,6 +125,7 @@ protected: const EnumStoreBase &esb, uint32_t minBvCocFreq, bool useBitVector); + ~PostingListSearchContextT(); void lookupSingle(void); size_t countHits(void) const; diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp index 3a4266f2254..693614110b8 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.hpp @@ -35,6 +35,9 @@ PostingListSearchContextT(const Dictionary &dictionary, { } +template <typename DataT> +PostingListSearchContextT<DataT>::~PostingListSearchContextT() {} + template <typename DataT> void diff --git a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h index 913b5d0f333..da9aea233af 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/singlestringpostattribute.h @@ -2,8 +2,8 @@ #pragma once -#include <vespa/searchlib/attribute/singlestringattribute.h> -#include <vespa/searchlib/attribute/postinglistattribute.h> +#include "singlestringattribute.h" +#include "postinglistattribute.h" namespace search { @@ -82,7 +82,7 @@ private: const std::map<DocId, EnumIndex> &currEnumIndices, PostingMap &changePost); - virtual void applyValueChanges(EnumStoreBase::IndexVector & unused) override; + void applyValueChanges(EnumStoreBase::IndexVector & unused) override; public: SingleValueStringPostingAttributeT(const vespalib::string & name, const AttributeVector::Config & c = AttributeVector::Config(AttributeVector::BasicType::STRING)); @@ -94,7 +94,7 @@ public: AttributeVector::SearchContext::UP getSearch(QueryTermSimpleUP term, const attribute::SearchContextParams & params) const override; - virtual bool onAddDoc(DocId doc) { + bool onAddDoc(DocId doc) override { return forwardedOnAddDoc(doc, this->_enumIndices.size(), this->_enumIndices.capacity()); } @@ -117,6 +117,4 @@ public: typedef SingleValueStringPostingAttributeT<EnumAttribute<StringAttribute> > SingleValueStringPostingAttribute; - } // namespace search - diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp index 3c86f0ebd70..aa3508315d5 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.cpp @@ -130,6 +130,8 @@ StringAttribute::StringAttribute(const vespalib::string & name, const Config & c { } +StringAttribute::~StringAttribute() {} + uint32_t StringAttribute::get(DocId doc, WeightedInt * v, uint32_t sz) const { WeightedConstChar * s = new WeightedConstChar[sz]; diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index 975352cdab9..9f648a9c8a0 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -57,6 +57,7 @@ public: protected: StringAttribute(const vespalib::string & name); StringAttribute(const vespalib::string & name, const Config & c); + ~StringAttribute(); static const char * defaultValue() { return ""; } typedef ChangeTemplate<StringChangeData> Change; typedef ChangeVectorT< Change > ChangeVector; diff --git a/searchlib/src/vespa/searchlib/btree/btreenode.h b/searchlib/src/vespa/searchlib/btree/btreenode.h index 759d23c8459..60e4fde9119 100644 --- a/searchlib/src/vespa/searchlib/btree/btreenode.h +++ b/searchlib/src/vespa/searchlib/btree/btreenode.h @@ -4,11 +4,11 @@ #include "noaggregated.h" #include "minmaxaggregated.h" -#include <assert.h> -#include <sys/types.h> -#include <utility> #include <vespa/searchlib/datastore/entryref.h> #include <vespa/searchlib/datastore/handle.h> +#include <cassert> +#include <utility> +#include <cstddef> namespace search { namespace datastore { @@ -42,15 +42,13 @@ protected: : _level(level), _isFrozen(false), _validSlots(0) - { - } + {} BTreeNode(const BTreeNode &rhs) : _level(rhs._level), _isFrozen(rhs._isFrozen), _validSlots(rhs._validSlots) - { - } + {} BTreeNode & operator=(const BTreeNode &rhs) @@ -62,50 +60,19 @@ protected: return *this; } - ~BTreeNode(void) - { - assert(_isFrozen); - } + ~BTreeNode() { assert(_isFrozen); } public: typedef datastore::EntryRef Ref; bool isLeaf() const { return _level == 0u; } - - bool - getFrozen(void) const - { - return _isFrozen; - } - - void - freeze(void) - { - _isFrozen = true; - } - - void - unFreeze(void) - { - _isFrozen = false; - } - - - void - setLevel(uint8_t level) - { - _level = level; - } - + bool getFrozen() const { return _isFrozen; } + void freeze() { _isFrozen = true; } + void unFreeze() { _isFrozen = false; } + void setLevel(uint8_t level) { _level = level; } uint32_t getLevel() const { return _level; } - uint32_t validSlots() const { return _validSlots; } - - void - setValidSlots(uint16_t validSlots_) - { - _validSlots = validSlots_; - } + void setValidSlots(uint16_t validSlots_) { _validSlots = validSlots_; } }; @@ -115,14 +82,10 @@ class BTreeNodeDataWrap public: DataT _data[NumSlots]; - BTreeNodeDataWrap(void) - : _data() - { - } + BTreeNodeDataWrap() : _data() {} + ~BTreeNodeDataWrap() { } - void - copyData(const BTreeNodeDataWrap &rhs, uint32_t validSlots) - { + void copyData(const BTreeNodeDataWrap &rhs, uint32_t validSlots) { const DataT *rdata = rhs._data; DataT *ldata = _data; DataT *ldatae = _data + validSlots; @@ -130,23 +93,9 @@ public: *ldata = *rdata; } - const DataT & - getData(uint32_t idx) const - { - return _data[idx]; - } - - void - setData(uint32_t idx, const DataT &data) - { - _data[idx] = data; - } - - static bool - hasData(void) - { - return true; - } + const DataT &getData(uint32_t idx) const { return _data[idx]; } + void setData(uint32_t idx, const DataT &data) { _data[idx] = data; } + static bool hasData() { return true; } }; @@ -168,36 +117,24 @@ template <uint32_t NumSlots> class BTreeNodeDataWrap<BTreeNoLeafData, NumSlots> { public: - BTreeNodeDataWrap(void) - { - } + BTreeNodeDataWrap() {} - void - copyData(const BTreeNodeDataWrap &rhs, uint32_t validSlots) - { + void copyData(const BTreeNodeDataWrap &rhs, uint32_t validSlots) { (void) rhs; (void) validSlots; } - const BTreeNoLeafData & - getData(uint32_t idx) const - { + const BTreeNoLeafData &getData(uint32_t idx) const { (void) idx; return BTreeNoLeafData::_instance; } - void - setData(uint32_t idx, const BTreeNoLeafData &data) - { + void setData(uint32_t idx, const BTreeNoLeafData &data) { (void) idx; (void) data; } - static bool - hasData(void) - { - return false; - } + static bool hasData(void) { return false; } }; @@ -211,37 +148,24 @@ public: KeyT _key; DataT _data; - BTreeKeyData(void) + BTreeKeyData() : _key(), _data() - { - } + {} BTreeKeyData(const KeyT &key, const DataT &data) : _key(key), _data(data) - { - } + {} - void - setData(const DataT &data) - { - _data = data; - } - - const DataT & - getData(void) const - { - return _data; - } + void setData(const DataT &data) { _data = data; } + const DataT &getData(void) const { return _data; } /** * This operator only works when using direct keys. References to * externally stored keys will not be properly sorted. */ - bool - operator<(const BTreeKeyData &rhs) const - { + bool operator<(const BTreeKeyData &rhs) const { return _key < rhs._key; } }; @@ -256,10 +180,7 @@ public: KeyT _key; - BTreeKeyData(void) - : _key() - { - } + BTreeKeyData() : _key() {} BTreeKeyData(const KeyT &key, const BTreeNoLeafData &data) : _key(key) @@ -267,25 +188,14 @@ public: (void) data; } - void - setData(const BTreeNoLeafData &data) - { - (void) data; - } - - const BTreeNoLeafData & - getData(void) const - { - return BTreeNoLeafData::_instance; - } + void setData(const BTreeNoLeafData &data) { (void) data; } + const BTreeNoLeafData &getData(void) const { return BTreeNoLeafData::_instance; } /** * This operator only works when using direct keys. References to * externally stored keys will not be properly sorted. */ - bool - operator<(const BTreeKeyData &rhs) const - { + bool operator<(const BTreeKeyData &rhs) const { return _key < rhs._key; } }; @@ -300,28 +210,12 @@ class BTreeNodeAggregatedWrap static AggrT _instance; public: - BTreeNodeAggregatedWrap(void) + BTreeNodeAggregatedWrap() : _aggr() - { - } - - AggrT & - getAggregated(void) - { - return _aggr; - } - - const AggrT & - getAggregated(void) const - { - return _aggr; - } - - static const AggrT & - getEmptyAggregated(void) - { - return _instance; - } + {} + AggrT &getAggregated() { return _aggr; } + const AggrT &getAggregated() const { return _aggr; } + static const AggrT &getEmptyAggregated() { return _instance; } }; @@ -332,27 +226,11 @@ class BTreeNodeAggregatedWrap<NoAggregated> static NoAggregated _instance; public: - BTreeNodeAggregatedWrap(void) - { - } - - NoAggregated & - getAggregated(void) - { - return _instance; - } - - const NoAggregated & - getAggregated(void) const - { - return _instance; - } + BTreeNodeAggregatedWrap() {} - static const NoAggregated & - getEmptyAggregated(void) - { - return _instance; - } + NoAggregated &getAggregated() { return _instance; } + const NoAggregated &getAggregated() const { return _instance; } + static const NoAggregated &getEmptyAggregated() { return _instance; } }; @@ -363,12 +241,9 @@ protected: BTreeNodeT(uint8_t level) : BTreeNode(level), _keys() - { - } + {} - ~BTreeNodeT(void) - { - } + ~BTreeNodeT() {} BTreeNodeT(const BTreeNodeT &rhs) : BTreeNode(rhs) @@ -398,16 +273,13 @@ public: void writeKey(uint32_t idx, const KeyT & key) { _keys[idx] = key; } template <typename CompareT> - uint32_t - lower_bound(uint32_t sidx, const KeyT & key, CompareT comp) const; + uint32_t lower_bound(uint32_t sidx, const KeyT & key, CompareT comp) const; template <typename CompareT> - uint32_t - lower_bound(const KeyT & key, CompareT comp) const; + uint32_t lower_bound(const KeyT & key, CompareT comp) const; template <typename CompareT> - uint32_t - upper_bound(uint32_t sidx, const KeyT & key, CompareT comp) const; + uint32_t upper_bound(uint32_t sidx, const KeyT & key, CompareT comp) const; bool isFull() const { return validSlots() == NumSlots; } bool isAtLeastHalfFull() const { return validSlots() >= minSlots(); } @@ -435,12 +307,9 @@ protected: BTreeNodeTT(uint8_t level) : ParentType(level), DataWrapType() - { - } + {} - ~BTreeNodeTT(void) - { - } + ~BTreeNodeTT() {} BTreeNodeTT(const BTreeNodeTT &rhs) : ParentType(rhs), @@ -450,9 +319,7 @@ protected: copyData(rhs, _validSlots); } - BTreeNodeTT & - operator=(const BTreeNodeTT &rhs) - { + BTreeNodeTT &operator=(const BTreeNodeTT &rhs) { ParentType::operator=(rhs); AggrWrapType::operator=(rhs); copyData(rhs, _validSlots); @@ -475,9 +342,8 @@ public: void stealSomeFromLeftNode(NodeType * victim); void stealSomeFromRightNode(NodeType * victim); void cleanRange(uint32_t from, uint32_t to); - void clean(void); - - void cleanFrozen(void); + void clean(); + void cleanFrozen(); }; template <typename KeyT, typename AggrT, uint32_t NumSlots = 16> @@ -517,99 +383,48 @@ private: BTreeInternalNode() : ParentType(EMPTY_LEVEL), _validLeaves(0u) - { - } - + {} BTreeInternalNode(const BTreeInternalNode &rhs) : ParentType(rhs), _validLeaves(rhs._validLeaves) - { - } + {} - ~BTreeInternalNode(void) - { - } + ~BTreeInternalNode() {} - BTreeInternalNode & - operator=(const BTreeInternalNode &rhs) - { + BTreeInternalNode &operator=(const BTreeInternalNode &rhs) { ParentType::operator=(rhs); _validLeaves = rhs._validLeaves; return *this; } public: - BTreeNode::Ref - getChild(uint32_t idx) const - { - return getData(idx); - } - - void - setChild(uint32_t idx, BTreeNode::Ref child) - { - setData(idx, child); - } - + BTreeNode::Ref getChild(uint32_t idx) const { return getData(idx); } + void setChild(uint32_t idx, BTreeNode::Ref child) { setData(idx, child); } BTreeNode::Ref getLastChild() const { return getChild(validSlots() - 1); } - - uint32_t - validLeaves(void) const - { - return _validLeaves; - } - - void - setValidLeaves(uint32_t newValidLeaves) - { - _validLeaves = newValidLeaves; - } - - void - incValidLeaves(uint32_t delta) - { - _validLeaves += delta; - } - - void - decValidLeaves(uint32_t delta) - { - _validLeaves -= delta; - } + uint32_t validLeaves() const { return _validLeaves; } + void setValidLeaves(uint32_t newValidLeaves) { _validLeaves = newValidLeaves; } + void incValidLeaves(uint32_t delta) { _validLeaves += delta; } + void decValidLeaves(uint32_t delta) { _validLeaves -= delta; } template <typename NodeAllocatorType> - void - splitInsert(BTreeInternalNode *splitNode, uint32_t idx, const KeyT &key, - const BTreeNode::Ref &data, - NodeAllocatorType &allocator); - - void - stealAllFromLeftNode(const BTreeInternalNode *victim); + void splitInsert(BTreeInternalNode *splitNode, uint32_t idx, const KeyT &key, + const BTreeNode::Ref &data, NodeAllocatorType &allocator); - void - stealAllFromRightNode(const BTreeInternalNode *victim); + void stealAllFromLeftNode(const BTreeInternalNode *victim); + void stealAllFromRightNode(const BTreeInternalNode *victim); template <typename NodeAllocatorType> - void - stealSomeFromLeftNode(BTreeInternalNode *victim, - NodeAllocatorType &allocator); + void stealSomeFromLeftNode(BTreeInternalNode *victim, NodeAllocatorType &allocator); template <typename NodeAllocatorType> - void - stealSomeFromRightNode(BTreeInternalNode *victim, - NodeAllocatorType &allocator); + void stealSomeFromRightNode(BTreeInternalNode *victim, NodeAllocatorType &allocator); - void - clean(void); - - void - cleanFrozen(void); + void clean(); + void cleanFrozen(); template <typename NodeStoreType, typename FunctionType> - void - foreach_key(NodeStoreType &store, FunctionType func) const - { + void foreach_key(NodeStoreType &store, FunctionType func) const { const BTreeNode::Ref *it = this->_data; const BTreeNode::Ref *ite = it + _validSlots; if (this->getLevel() > 1u) { @@ -624,9 +439,7 @@ public: } template <typename NodeStoreType, typename FunctionType> - void - foreach(NodeStoreType &store, FunctionType func) const - { + void foreach(NodeStoreType &store, FunctionType func) const { const BTreeNode::Ref *it = this->_data; const BTreeNode::Ref *ite = it + _validSlots; if (this->getLevel() > 1u) { @@ -676,63 +489,37 @@ private: protected: BTreeLeafNode(const BTreeLeafNode &rhs) : ParentType(rhs) - { - } + {} BTreeLeafNode(const KeyDataType *smallArray, uint32_t arraySize); - ~BTreeLeafNode(void) - { - } + ~BTreeLeafNode() {} - BTreeLeafNode & - operator=(const BTreeLeafNode &rhs) - { + BTreeLeafNode &operator=(const BTreeLeafNode &rhs) { ParentType::operator=(rhs); return *this; } public: template <typename NodeAllocatorType> - void - stealSomeFromLeftNode(BTreeLeafNode *victim, - NodeAllocatorType &allocator) + void stealSomeFromLeftNode(BTreeLeafNode *victim, NodeAllocatorType &allocator) { (void) allocator; stealSomeFromLeftNode(victim); } template <typename NodeAllocatorType> - void - stealSomeFromRightNode(BTreeLeafNode *victim, - NodeAllocatorType &allocator) - { + void stealSomeFromRightNode(BTreeLeafNode *victim, NodeAllocatorType &allocator) { (void) allocator; stealSomeFromRightNode(victim); } - const DataT & - getLastData() const - { - return this->getData(validSlots() - 1); - } - - void - writeData(uint32_t idx, const DataT &data) - { - this->setData(idx, data); - } - - uint32_t - validLeaves(void) const - { - return validSlots(); - } + const DataT &getLastData() const { return this->getData(validSlots() - 1); } + void writeData(uint32_t idx, const DataT &data) { this->setData(idx, data); } + uint32_t validLeaves() const { return validSlots(); } template <typename FunctionType> - void - foreach_key(FunctionType func) const - { + void foreach_key(FunctionType func) const { const KeyT *it = _keys; const KeyT *ite = it + _validSlots; for (; it != ite; ++it) { @@ -741,9 +528,7 @@ public: } template <typename FunctionType> - void - foreach(FunctionType func) const - { + void foreach(FunctionType func) const { const KeyT *it = _keys; const KeyT *ite = it + _validSlots; uint32_t idx = 0; @@ -765,12 +550,9 @@ public: BTreeLeafNodeTemp(const KeyDataType *smallArray, uint32_t arraySize) : ParentType(smallArray, arraySize) - { - } + {} - ~BTreeLeafNodeTemp(void) - { - } + ~BTreeLeafNodeTemp() {} }; extern template class BTreeNodeDataWrap<uint32_t, 16>; @@ -796,4 +578,3 @@ extern template class BTreeLeafNodeTemp<uint32_t, BTreeNoLeafData, } // namespace search::btree } // namespace search - diff --git a/searchlib/src/vespa/searchlib/common/converters.h b/searchlib/src/vespa/searchlib/common/converters.h index 9eadeb5a8c5..694e53bb1a5 100644 --- a/searchlib/src/vespa/searchlib/common/converters.h +++ b/searchlib/src/vespa/searchlib/common/converters.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/searchcommon/common/iblobconverter.h> -#include <vector> #include <vespa/vespalib/stllike/string.h> namespace search { @@ -12,7 +11,7 @@ namespace common { class PassThroughConverter : public BlobConverter { private: - virtual ConstBufferRef onConvert(const ConstBufferRef & src) const; + ConstBufferRef onConvert(const ConstBufferRef & src) const override; }; class LowercaseConverter : public BlobConverter @@ -20,7 +19,7 @@ class LowercaseConverter : public BlobConverter public: LowercaseConverter(); private: - virtual ConstBufferRef onConvert(const ConstBufferRef & src) const; + ConstBufferRef onConvert(const ConstBufferRef & src) const override; mutable vespalib::string _buffer; }; diff --git a/searchlib/src/vespa/searchlib/common/featureset.cpp b/searchlib/src/vespa/searchlib/common/featureset.cpp index df3c1cf2b5e..64ec201d3d5 100644 --- a/searchlib/src/vespa/searchlib/common/featureset.cpp +++ b/searchlib/src/vespa/searchlib/common/featureset.cpp @@ -1,7 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/common/featureset.h> +#include "featureset.h" namespace search { @@ -12,6 +11,8 @@ FeatureSet::FeatureSet() { } +FeatureSet::~FeatureSet() {} + FeatureSet::FeatureSet(const StringVector &names, uint32_t expectDocs) : _names(names), _docIds(), diff --git a/searchlib/src/vespa/searchlib/common/featureset.h b/searchlib/src/vespa/searchlib/common/featureset.h index cd1f0595da7..2ccfccef5e7 100644 --- a/searchlib/src/vespa/searchlib/common/featureset.h +++ b/searchlib/src/vespa/searchlib/common/featureset.h @@ -2,10 +2,10 @@ #pragma once -#include <map> +#include "feature.h" #include <vespa/vespalib/stllike/string.h> +#include <map> #include <vector> -#include "feature.h" namespace search { @@ -37,6 +37,7 @@ public: * Create a new object without any feature information. **/ FeatureSet(); + ~FeatureSet(); /** * Create a new object that will contain information about the diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp index 45d7f0ac82d..4344895ad63 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.cpp @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".indexmetainfo"); +#include "indexmetainfo.h" #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/guard.h> -#include <vespa/searchlib/common/indexmetainfo.h> -#include <algorithm> + +#include <vespa/log/log.h> +LOG_SETUP(".indexmetainfo"); namespace { @@ -198,6 +197,7 @@ IndexMetaInfo::IndexMetaInfo(const vespalib::string &path) { } +IndexMetaInfo::~IndexMetaInfo() {} IndexMetaInfo::Snapshot IndexMetaInfo::getBestSnapshot() const diff --git a/searchlib/src/vespa/searchlib/common/indexmetainfo.h b/searchlib/src/vespa/searchlib/common/indexmetainfo.h index df731004362..15d37c59719 100644 --- a/searchlib/src/vespa/searchlib/common/indexmetainfo.h +++ b/searchlib/src/vespa/searchlib/common/indexmetainfo.h @@ -41,6 +41,7 @@ private: public: IndexMetaInfo(const vespalib::string &path); + ~IndexMetaInfo(); vespalib::string getPath() const { return _path; } void setPath(const vespalib::string &path) { _path = path; } diff --git a/searchlib/src/vespa/searchlib/common/lambdatask.h b/searchlib/src/vespa/searchlib/common/lambdatask.h index e6fb87e95dc..50538c39cd5 100644 --- a/searchlib/src/vespa/searchlib/common/lambdatask.h +++ b/searchlib/src/vespa/searchlib/common/lambdatask.h @@ -3,8 +3,7 @@ #include <vespa/vespalib/util/executor.h> -namespace search -{ +namespace search { template <class FunctionType> class LambdaTask : public vespalib::Executor::Task { @@ -13,7 +12,7 @@ class LambdaTask : public vespalib::Executor::Task { public: LambdaTask(const FunctionType &func) : _func(func) {} LambdaTask(FunctionType &&func) : _func(std::move(func)) {} - virtual void run() override { _func(); } + void run() override { _func(); } }; template <class FunctionType> @@ -24,5 +23,4 @@ makeLambdaTask(FunctionType &&function) (std::forward<FunctionType>(function)); } - } // namespace search diff --git a/searchlib/src/vespa/searchlib/common/sortspec.cpp b/searchlib/src/vespa/searchlib/common/sortspec.cpp index b81c812b830..47ad70131e3 100644 --- a/searchlib/src/vespa/searchlib/common/sortspec.cpp +++ b/searchlib/src/vespa/searchlib/common/sortspec.cpp @@ -1,15 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/common/sortspec.h> -#include <vespa/searchlib/common/converters.h> +#include "sortspec.h" #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/sync.h> -#include <unicode/ustring.h> -#include <stdexcept> #include <vespa/fastlib/text/normwordfolder.h> #include <vespa/vespalib/text/utf8.h> -#include <vespa/log/log.h> -LOG_SETUP(".search.common.sortspec"); namespace search { namespace common { @@ -41,6 +35,11 @@ ConstBufferRef LowercaseConverter::onConvert(const ConstBufferRef & src) const return ConstBufferRef(_buffer.begin(), _buffer.size()); } +SortInfo::SortInfo(const vespalib::string & field, bool ascending, const BlobConverter::SP & converter) + : _field(field), _ascending(ascending), _converter(converter) +{ } +SortInfo::~SortInfo() {} + SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFactory) : _spec(spec) { @@ -105,5 +104,7 @@ SortSpec::SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFa } } +SortSpec::~SortSpec() {} + } } diff --git a/searchlib/src/vespa/searchlib/common/sortspec.h b/searchlib/src/vespa/searchlib/common/sortspec.h index bc8af043d55..75d2af42035 100644 --- a/searchlib/src/vespa/searchlib/common/sortspec.h +++ b/searchlib/src/vespa/searchlib/common/sortspec.h @@ -1,20 +1,19 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Copyright (C) 1998-2003 Fast Search & Transfer ASA -// Copyright (C) 2003 Overture Services Norway AS #pragma once +#include "converters.h" +#include <vespa/searchcommon/common/iblobconverter.h> #include <vespa/vespalib/util/buffer.h> -#include <vector> #include <vespa/vespalib/stllike/string.h> -#include <vespa/searchcommon/common/iblobconverter.h> -#include <vespa/searchlib/common/converters.h> +#include <vector> namespace search { namespace common { struct SortInfo { - SortInfo(const vespalib::string & field, bool ascending, const BlobConverter::SP & converter) : _field(field), _ascending(ascending), _converter(converter) { } + SortInfo(const vespalib::string & field, bool ascending, const BlobConverter::SP & converter); + ~SortInfo(); vespalib::string _field; bool _ascending; BlobConverter::SP _converter; @@ -25,6 +24,7 @@ class SortSpec : public std::vector<SortInfo> public: SortSpec() : _spec() { } SortSpec(const vespalib::string & spec, const ConverterFactory & ucaFactory); + ~SortSpec(); const vespalib::string & getSpec() const { return _spec; } private: vespalib::string _spec; @@ -32,4 +32,3 @@ private: } } - diff --git a/searchlib/src/vespa/searchlib/datastore/array_store_config.h b/searchlib/src/vespa/searchlib/datastore/array_store_config.h index 6ada8cdae05..c60eaf18f9e 100644 --- a/searchlib/src/vespa/searchlib/datastore/array_store_config.h +++ b/searchlib/src/vespa/searchlib/datastore/array_store_config.h @@ -2,6 +2,9 @@ #pragma once +#include <cstddef> +#include <vector> + namespace search { namespace datastore { diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp index 6a2d441396d..b66f61095dd 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp @@ -58,20 +58,18 @@ DiskIndex::DiskIndex(const vespalib::string &indexDir, size_t cacheSize) calculateSize(); } +DiskIndex::~DiskIndex() {} + bool DiskIndex::loadSchema(void) { vespalib::string schemaName = _indexDir + "/schema.txt"; if (!_schema.loadFromFile(schemaName)) { - LOG(error, - "Could not open schema '%s'", - schemaName.c_str()); + LOG(error, "Could not open schema '%s'", schemaName.c_str()); return false; } if (!SchemaUtil::validateSchema(_schema)) { - LOG(error, - "Could not validate schema loaded from '%s'", - schemaName.c_str()); + LOG(error, "Could not validate schema loaded from '%s'", schemaName.c_str()); return false; } return true; @@ -86,8 +84,7 @@ DiskIndex::openDictionaries(const TuneFileSearch &tuneFileSearch) _indexDir + "/" + itr.getName() + "/dictionary"; auto dict = std::make_unique<PageDict4RandRead>(); if (!dict->open(dictName, tuneFileSearch._read)) { - LOG(warning, "Could not open disk dictionary '%s'", - dictName.c_str()); + LOG(warning, "Could not open disk dictionary '%s'", dictName.c_str()); _dicts.clear(); return false; } diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.h b/searchlib/src/vespa/searchlib/diskindex/diskindex.h index 9767aa59eda..9f28b930b4d 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.h +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.h @@ -2,12 +2,13 @@ #pragma once -#include <vespa/vespalib/stllike/cache.h> -#include <vespa/searchlib/diskindex/bitvectordictionary.h> +#include "bitvectordictionary.h" +#include "zcposoccrandread.h" #include <vespa/searchlib/index/dictionaryfile.h> -#include <vespa/searchlib/diskindex/zcposoccrandread.h> #include <vespa/searchlib/queryeval/searchable.h> #include <vespa/vespalib/stllike/string.h> +#include <vespa/vespalib/stllike/cache.h> + namespace search { @@ -79,16 +80,9 @@ private: uint64_t _size; void calculateSize(); - - bool - loadSchema(void); - - bool - openDictionaries(const TuneFileSearch &tuneFileSearch); - - bool - openField(const vespalib::string &fieldDir, - const TuneFileSearch &tuneFileSearch); + bool loadSchema(); + bool openDictionaries(const TuneFileSearch &tuneFileSearch); + bool openField(const vespalib::string &fieldDir, const TuneFileSearch &tuneFileSearch); public: /** @@ -98,17 +92,15 @@ public: * @param indexDir the directory where the disk index is located. **/ DiskIndex(const vespalib::string &indexDir, size_t cacheSize=0); + ~DiskIndex(); /** * Setup this instance by opening and loading relevant index files. * * @return true if this instance was successfully setup. **/ - bool - setup(const TuneFileSearch &tuneFileSearch); - - bool - setup(const TuneFileSearch &tuneFileSearch, const DiskIndex &old); + bool setup(const TuneFileSearch &tuneFileSearch); + bool setup(const TuneFileSearch &tuneFileSearch, const DiskIndex &old); /** * Perform a dictionary lookup for the given word in the given @@ -119,11 +111,8 @@ public: * @param word the word to lookup. * @return the lookup result or NULL if the word is not found. **/ - LookupResult::UP - lookup(uint32_t indexId, const vespalib::stringref & word); - - LookupResultVector - lookup(const std::vector<uint32_t> & indexes, const vespalib::stringref & word); + LookupResult::UP lookup(uint32_t indexId, const vespalib::stringref & word); + LookupResultVector lookup(const std::vector<uint32_t> & indexes, const vespalib::stringref & word); /** @@ -132,8 +121,7 @@ public: * @param lookupRes the result of the previous dictionary lookup. * @return a handle for the posting list in memory. **/ - index::PostingListHandle::UP - readPostingList(const LookupResult &lookupRes) const; + index::PostingListHandle::UP readPostingList(const LookupResult &lookupRes) const; /** * Read the bit vector corresponding to the given lookup result. @@ -142,8 +130,7 @@ public: * @return the bit vector or NULL if no bit vector exists for the * word in the lookup result. **/ - BitVector::UP - readBitVector(const LookupResult &lookupRes) const; + BitVector::UP readBitVector(const LookupResult &lookupRes) const; queryeval::Blueprint::UP createBlueprint(const queryeval::IRequestContext & requestContext, diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp index 25875d3621d..c424cb61d8c 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp @@ -36,6 +36,8 @@ BlobSet::BlobSet() : _buffer(Alloc::alloc(0, 16 * MemoryAllocator::HUGEPAGE_SIZE), 0) { } +BlobSet::~BlobSet() {} + namespace { size_t getBufferSize(const BlobSet::Positions & p) { diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.h b/searchlib/src/vespa/searchlib/docstore/visitcache.h index fd61544ecc5..76519daa636 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.h +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.h @@ -50,6 +50,9 @@ public: using Positions = std::vector<LidPosition>; BlobSet(); BlobSet(const Positions & positions, vespalib::alloc::Alloc && buffer); + BlobSet(BlobSet &&) = default; + BlobSet &operator = (BlobSet &&) = default; + ~BlobSet(); void append(uint32_t lid, vespalib::ConstBufferRef blob); void remove(uint32_t lid); const Positions & getPositions() const { return _positions; } diff --git a/searchlib/src/vespa/searchlib/expression/attributenode.cpp b/searchlib/src/vespa/searchlib/expression/attributenode.cpp index 3800f0bac50..8f030204535 100644 --- a/searchlib/src/vespa/searchlib/expression/attributenode.cpp +++ b/searchlib/src/vespa/searchlib/expression/attributenode.cpp @@ -3,8 +3,7 @@ #include "attributenode.h" #include <vespa/searchlib/attribute/singleenumattribute.h> -namespace search { -namespace expression { +namespace search::expression { using namespace vespalib; using search::attribute::IAttributeContext; @@ -52,8 +51,9 @@ AttributeNode::AttributeNode() : _useEnumOptimization(false), _handler(), _attributeName() -{ -} +{} + +AttributeNode::~AttributeNode() {} AttributeNode::AttributeNode(const vespalib::stringref &name) : FunctionNode(), @@ -62,8 +62,7 @@ AttributeNode::AttributeNode(const vespalib::stringref &name) : _useEnumOptimization(false), _handler(), _attributeName(name) -{ -} +{} AttributeNode::AttributeNode(const IAttributeVector & attribute) : FunctionNode(), _scratchResult(createResult(&attribute)), @@ -71,8 +70,7 @@ AttributeNode::AttributeNode(const IAttributeVector & attribute) : _useEnumOptimization(false), _handler(), _attributeName(attribute.getName()) -{ -} +{} AttributeNode::AttributeNode(const AttributeNode & attribute) : FunctionNode(attribute), @@ -276,7 +274,6 @@ AttributeNode::visitMembers(vespalib::ObjectVisitor &visitor) const } } -} // this function was added by ../../forcelink.sh void forcelink_file_searchlib_expression_attributenode() {} diff --git a/searchlib/src/vespa/searchlib/expression/attributenode.h b/searchlib/src/vespa/searchlib/expression/attributenode.h index f9f098f6977..ffff19dd333 100644 --- a/searchlib/src/vespa/searchlib/expression/attributenode.h +++ b/searchlib/src/vespa/searchlib/expression/attributenode.h @@ -7,8 +7,7 @@ #include <vespa/vespalib/objects/objectoperation.h> #include <vespa/vespalib/objects/objectpredicate.h> -namespace search { -namespace expression { +namespace search::expression { class AttributeResult : public ResultNode { @@ -74,6 +73,7 @@ public: AttributeNode(const search::attribute::IAttributeVector & attribute); AttributeNode(const AttributeNode & attribute); AttributeNode & operator = (const AttributeNode & attribute); + ~AttributeNode(); void setDocId(DocId docId) const { _scratchResult->setDocId(docId); } const search::attribute::IAttributeVector *getAttribute() const { return _scratchResult ? _scratchResult->getAttribute() : nullptr; @@ -154,5 +154,3 @@ private: }; } -} - diff --git a/searchlib/src/vespa/searchlib/expression/debugwaitfunctionnode.h b/searchlib/src/vespa/searchlib/expression/debugwaitfunctionnode.h index be4d9770dbb..b299e008b58 100644 --- a/searchlib/src/vespa/searchlib/expression/debugwaitfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/debugwaitfunctionnode.h @@ -2,10 +2,9 @@ #pragma once #include "unaryfunctionnode.h" -#include <vespa/searchlib/common/sortspec.h> #include "stringresultnode.h" #include "resultvector.h" - +#include <vespa/searchlib/common/sortspec.h> namespace search { namespace expression { @@ -18,13 +17,12 @@ public: DebugWaitFunctionNode(); ~DebugWaitFunctionNode(); DebugWaitFunctionNode(ExpressionNode::UP arg, double waitTime, bool busyWait); - virtual void visitMembers(vespalib::ObjectVisitor &visitor) const; + void visitMembers(vespalib::ObjectVisitor &visitor) const override; private: - virtual bool onExecute() const; + bool onExecute() const override; double _waitTime; bool _busyWait; }; } } - diff --git a/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.cpp index 962725d5fee..c4f2f725271 100644 --- a/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.cpp @@ -80,6 +80,8 @@ FixedWidthBucketFunctionNode::FloatBucketHandler::update(ResultNode &result, con bucket.setRange(from, to); } +FixedWidthBucketFunctionNode::~FixedWidthBucketFunctionNode() {} + void FixedWidthBucketFunctionNode::onPrepareResult() { diff --git a/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.h b/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.h index 2e00a97f586..233fd0abaec 100644 --- a/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/fixedwidthbucketfunctionnode.h @@ -60,6 +60,7 @@ public: DECLARE_NBO_SERIALIZE; FixedWidthBucketFunctionNode() : UnaryFunctionNode(), _width(), _bucketHandler() {} FixedWidthBucketFunctionNode(ExpressionNode::UP arg) : UnaryFunctionNode(std::move(arg)), _width(), _bucketHandler() {} + ~FixedWidthBucketFunctionNode(); FixedWidthBucketFunctionNode &setWidth(const NumericResultNode::CP &width) { _width = width; return *this; @@ -68,4 +69,3 @@ public: } } - diff --git a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp index bbb79d36e66..cbd56b71962 100644 --- a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp +++ b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp @@ -43,8 +43,7 @@ #include <map> #include <vespa/vespalib/util/md5.h> -namespace search { -namespace expression { +namespace search::expression { using vespalib::asciistream; using vespalib::nbostream; @@ -487,11 +486,13 @@ bool CatFunctionNode::onExecute() const return true; } +XorBitFunctionNode::XorBitFunctionNode() {} +XorBitFunctionNode::~XorBitFunctionNode() {} + XorBitFunctionNode::XorBitFunctionNode(ExpressionNode::UP arg, unsigned numBits) : UnaryBitFunctionNode(std::move(arg), numBits), _tmpXor(getNumBytes(), 0) -{ -} +{} bool UnaryBitFunctionNode::onExecute() const { @@ -625,4 +626,3 @@ UnaryBitFunctionNode::visitMembers(vespalib::ObjectVisitor &visitor) const } } -} diff --git a/searchlib/src/vespa/searchlib/expression/mathfunctionnode.h b/searchlib/src/vespa/searchlib/expression/mathfunctionnode.h index 3546a100b05..a79f48dd60b 100644 --- a/searchlib/src/vespa/searchlib/expression/mathfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/mathfunctionnode.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/searchlib/expression/unaryfunctionnode.h> +#include "unaryfunctionnode.h" namespace search { namespace expression { @@ -16,8 +16,8 @@ public: MathFunctionNode() { } private: - virtual bool onExecute() const; - virtual void onPrepareResult(); + bool onExecute() const override; + void onPrepareResult() override; Function _function; }; diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp index 5b3e34c564f..2110fd3d37c 100644 --- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.cpp @@ -1,13 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/expression/numericfunctionnode.h> -#include <stdexcept> +#include "numericfunctionnode.h" -namespace search { -namespace expression { +namespace search::expression { IMPLEMENT_ABSTRACT_EXPRESSIONNODE(NumericFunctionNode, MultiArgFunctionNode); +NumericFunctionNode::NumericFunctionNode() : _handler() { } +NumericFunctionNode::~NumericFunctionNode() {} + NumericFunctionNode::NumericFunctionNode(const NumericFunctionNode & rhs) : MultiArgFunctionNode(rhs), _handler() @@ -148,7 +148,6 @@ void NumericFunctionNode::FlattenStringHandler::handle(const ResultNode & arg) } } -} // this function was added by ../../forcelink.sh diff --git a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h index aa3a6876eb2..57939adf1f8 100644 --- a/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/numericfunctionnode.h @@ -11,9 +11,10 @@ class NumericFunctionNode : public MultiArgFunctionNode { public: DECLARE_ABSTRACT_EXPRESSIONNODE(NumericFunctionNode); - NumericFunctionNode() : _handler() { } + NumericFunctionNode(); NumericFunctionNode(const NumericFunctionNode & rhs); NumericFunctionNode & operator = (const NumericFunctionNode & rhs); + ~NumericFunctionNode(); void reset() override { _handler.reset(); MultiArgFunctionNode::reset(); } protected: void onPrepare(bool preserveAccurateTypes) override; diff --git a/searchlib/src/vespa/searchlib/expression/rangebucketpredef.cpp b/searchlib/src/vespa/searchlib/expression/rangebucketpredef.cpp index dc2a2e72b6a..a4f9d17140c 100644 --- a/searchlib/src/vespa/searchlib/expression/rangebucketpredef.cpp +++ b/searchlib/src/vespa/searchlib/expression/rangebucketpredef.cpp @@ -1,19 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "rangebucketpredef.h" -#include "integerresultnode.h" -#include "floatresultnode.h" -#include "integerbucketresultnode.h" -#include "floatbucketresultnode.h" -#include <vespa/vespalib/util/stringfmt.h> -#include <stdexcept> -#include <limits> namespace search { namespace expression { IMPLEMENT_EXPRESSIONNODE(RangeBucketPreDefFunctionNode, UnaryFunctionNode); +RangeBucketPreDefFunctionNode::~RangeBucketPreDefFunctionNode() {} + RangeBucketPreDefFunctionNode::RangeBucketPreDefFunctionNode(const RangeBucketPreDefFunctionNode & rhs) : UnaryFunctionNode(rhs), _predef(rhs._predef), diff --git a/searchlib/src/vespa/searchlib/expression/rangebucketpredef.h b/searchlib/src/vespa/searchlib/expression/rangebucketpredef.h index 3de4ea77530..361495d1106 100644 --- a/searchlib/src/vespa/searchlib/expression/rangebucketpredef.h +++ b/searchlib/src/vespa/searchlib/expression/rangebucketpredef.h @@ -61,6 +61,7 @@ public: RangeBucketPreDefFunctionNode(ExpressionNode::UP arg) : UnaryFunctionNode(std::move(arg)), _predef(), _result(NULL), _nullResult(NULL) {} RangeBucketPreDefFunctionNode(const RangeBucketPreDefFunctionNode & rhs); RangeBucketPreDefFunctionNode & operator = (const RangeBucketPreDefFunctionNode & rhs); + ~RangeBucketPreDefFunctionNode(); const ResultNode & getResult() const override { return *_result; } const ResultNodeVector & getBucketList() const { return *_predef; } ResultNodeVector & getBucketList() { return *_predef; } diff --git a/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.cpp b/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.cpp index 27a187addb6..344903e5820 100644 --- a/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.cpp @@ -36,6 +36,14 @@ RawBucketResultNode::hash() const #endif } + +RawBucketResultNode::RawBucketResultNode() + : _from(new RawResultNode()), + _to(new RawResultNode()) +{} + +RawBucketResultNode::~RawBucketResultNode() {} + int RawBucketResultNode::onCmp(const Identifiable & rhs) const { diff --git a/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.h b/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.h index 1206e72bbc1..719ac40c7be 100644 --- a/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.h +++ b/searchlib/src/vespa/searchlib/expression/rawbucketresultnode.h @@ -22,8 +22,9 @@ public: DECLARE_EXPRESSIONNODE(RawBucketResultNode); DECLARE_NBO_SERIALIZE; - RawBucketResultNode() : _from(new RawResultNode()), _to(new RawResultNode()) {} + RawBucketResultNode(); RawBucketResultNode(ResultNode::UP from, ResultNode::UP to) : _from(from.release()), _to(to.release()) {} + ~RawBucketResultNode(); size_t hash() const override; int onCmp(const Identifiable & b) const override; int contains(const RawBucketResultNode & b) const; diff --git a/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.cpp b/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.cpp index d348fbb849d..de7ef05f31c 100644 --- a/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.cpp +++ b/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.cpp @@ -36,6 +36,16 @@ StringBucketResultNode::hash() const #endif } +StringBucketResultNode::StringBucketResultNode() + : _from(new StringResultNode()), + _to(new StringResultNode()) +{} +StringBucketResultNode::StringBucketResultNode(const vespalib::stringref & from, const vespalib::stringref & to) + : _from(new StringResultNode(from)), + _to(new StringResultNode(to)) +{} +StringBucketResultNode::~StringBucketResultNode() {} + int StringBucketResultNode::onCmp(const Identifiable & rhs) const { diff --git a/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.h b/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.h index ea230000853..5608857c6b1 100644 --- a/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.h +++ b/searchlib/src/vespa/searchlib/expression/stringbucketresultnode.h @@ -22,9 +22,10 @@ public: DECLARE_EXPRESSIONNODE(StringBucketResultNode); DECLARE_NBO_SERIALIZE; - StringBucketResultNode() : _from(new StringResultNode()), _to(new StringResultNode()) {} - StringBucketResultNode(const vespalib::stringref & from, const vespalib::stringref & to) : _from(new StringResultNode(from)), _to(new StringResultNode(to)) {} + StringBucketResultNode(); + StringBucketResultNode(const vespalib::stringref & from, const vespalib::stringref & to); StringBucketResultNode(ResultNode::UP from, ResultNode::UP to) : _from(from.release()), _to(to.release()) {} + ~StringBucketResultNode(); size_t hash() const override; int onCmp(const Identifiable & b) const override; int contains(const StringBucketResultNode & b) const; diff --git a/searchlib/src/vespa/searchlib/expression/timestamp.cpp b/searchlib/src/vespa/searchlib/expression/timestamp.cpp index 6191af0f546..9edb896ef2d 100644 --- a/searchlib/src/vespa/searchlib/expression/timestamp.cpp +++ b/searchlib/src/vespa/searchlib/expression/timestamp.cpp @@ -1,9 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/expression/timestamp.h> -namespace search { -namespace expression { +#include "timestamp.h" + +namespace search::expression { using vespalib::FieldBase; using vespalib::Serializer; @@ -11,6 +10,17 @@ using vespalib::Deserializer; IMPLEMENT_EXPRESSIONNODE(TimeStampFunctionNode, UnaryFunctionNode); +TimeStampFunctionNode::TimeStampFunctionNode() + : _timePart(Year), + _isGmt(true) +{ } +TimeStampFunctionNode::TimeStampFunctionNode(ExpressionNode::UP arg, TimePart timePart, bool gmt) + : UnaryFunctionNode(std::move(arg)), + _timePart(timePart), + _isGmt(gmt) +{ } +TimeStampFunctionNode::~TimeStampFunctionNode() {} + TimeStampFunctionNode::TimeStampFunctionNode(const TimeStampFunctionNode & rhs) : UnaryFunctionNode(rhs), _timePart(rhs._timePart), @@ -102,7 +112,6 @@ Deserializer & TimeStampFunctionNode::onDeserialize(Deserializer & is) } } -} // this function was added by ../../forcelink.sh void forcelink_file_searchlib_expression_timestamp() {} diff --git a/searchlib/src/vespa/searchlib/expression/timestamp.h b/searchlib/src/vespa/searchlib/expression/timestamp.h index c17d746ee00..9f167404878 100644 --- a/searchlib/src/vespa/searchlib/expression/timestamp.h +++ b/searchlib/src/vespa/searchlib/expression/timestamp.h @@ -1,12 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchlib/expression/unaryfunctionnode.h> -#include <vespa/searchlib/expression/integerresultnode.h> -#include <vespa/searchlib/expression/resultvector.h> +#include "unaryfunctionnode.h" +#include "integerresultnode.h" +#include "resultvector.h" -namespace search { -namespace expression { +namespace search::expression { class TimeStampFunctionNode : public UnaryFunctionNode { @@ -14,12 +13,9 @@ public: enum TimePart { Year=0, Month=1, MonthDay=2, WeekDay=3, Hour=4, Minute=5, Second=6, YearDay=7, IsDST=8 }; DECLARE_EXPRESSIONNODE(TimeStampFunctionNode); DECLARE_NBO_SERIALIZE; - TimeStampFunctionNode() : _timePart(Year), _isGmt(true) { } - TimeStampFunctionNode(ExpressionNode::UP arg, TimePart timePart, bool gmt=true) - : UnaryFunctionNode(std::move(arg)), - _timePart(timePart), - _isGmt(gmt) - { } + TimeStampFunctionNode(); + TimeStampFunctionNode(ExpressionNode::UP arg, TimePart timePart, bool gmt=true); + ~TimeStampFunctionNode(); TimeStampFunctionNode(const TimeStampFunctionNode & rhs); TimeStampFunctionNode & operator = (const TimeStampFunctionNode & rhs); unsigned int getTime() const { return getResult().getInteger(); } // Not valid until after node has been prepared @@ -37,8 +33,8 @@ unsigned hour(timestamp); [0-23] unsigned minute(timestamp);[0-59] unsigned second(timestamp);[0-59] */ - virtual bool onExecute() const; - virtual void onPrepareResult(); + bool onExecute() const override; + void onPrepareResult() override; private: class Handler { public: @@ -56,14 +52,14 @@ private: class SingleValueHandler : public Handler { public: SingleValueHandler(TimeStampFunctionNode & ts) : Handler(ts), _result(static_cast<Int64ResultNode &>(ts.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: Int64ResultNode & _result; }; class MultiValueHandler : public Handler { public: MultiValueHandler(TimeStampFunctionNode & ts) : Handler(ts), _result(static_cast<IntegerResultNodeVector &>(ts.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: IntegerResultNodeVector & _result; }; @@ -78,5 +74,3 @@ private: }; } -} - diff --git a/searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h b/searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h index 4ddc5bd7d7b..1a4dc678072 100644 --- a/searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h +++ b/searchlib/src/vespa/searchlib/expression/xorbitfunctionnode.h @@ -3,15 +3,15 @@ #include "unarybitfunctionnode.h" -namespace search { -namespace expression { +namespace search::expression { class XorBitFunctionNode : public UnaryBitFunctionNode { public: DECLARE_EXPRESSIONNODE(XorBitFunctionNode); - XorBitFunctionNode() { } + XorBitFunctionNode(); XorBitFunctionNode(ExpressionNode::UP arg, unsigned numBits); + ~XorBitFunctionNode(); private: mutable std::vector<uint8_t> _tmpXor; bool internalExecute(const vespalib::nbostream & os) const override; @@ -19,5 +19,3 @@ private: }; } -} - diff --git a/searchlib/src/vespa/searchlib/expression/zcurve.cpp b/searchlib/src/vespa/searchlib/expression/zcurve.cpp index dd22ca7c8fe..6b072a5cf19 100644 --- a/searchlib/src/vespa/searchlib/expression/zcurve.cpp +++ b/searchlib/src/vespa/searchlib/expression/zcurve.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/fastos/fastos.h> -#include <vespa/searchlib/expression/zcurve.h> + +#include "zcurve.h" #include <vespa/vespalib/geo/zcurve.h> using vespalib::FieldBase; @@ -12,6 +12,8 @@ namespace expression { IMPLEMENT_EXPRESSIONNODE(ZCurveFunctionNode, UnaryFunctionNode); +ZCurveFunctionNode::~ZCurveFunctionNode() {} + ZCurveFunctionNode::ZCurveFunctionNode(const ZCurveFunctionNode & rhs) : UnaryFunctionNode(rhs), _dim(rhs._dim), diff --git a/searchlib/src/vespa/searchlib/expression/zcurve.h b/searchlib/src/vespa/searchlib/expression/zcurve.h index 1f570405025..7ecd4d07ac8 100644 --- a/searchlib/src/vespa/searchlib/expression/zcurve.h +++ b/searchlib/src/vespa/searchlib/expression/zcurve.h @@ -1,9 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchlib/expression/unaryfunctionnode.h> -#include <vespa/searchlib/expression/integerresultnode.h> -#include <vespa/searchlib/expression/resultvector.h> +#include "unaryfunctionnode.h" +#include "integerresultnode.h" +#include "resultvector.h" namespace search { namespace expression { @@ -18,6 +18,7 @@ public: ZCurveFunctionNode(ExpressionNode::UP arg, Dimension dim) : UnaryFunctionNode(std::move(arg)), _dim(dim) { } ZCurveFunctionNode(const ZCurveFunctionNode & rhs); ZCurveFunctionNode & operator = (const ZCurveFunctionNode & rhs); + ~ZCurveFunctionNode(); Dimension getDim() const { return _dim; } private: class Handler { @@ -36,24 +37,23 @@ private: class SingleValueHandler : public Handler { public: SingleValueHandler(ZCurveFunctionNode & ts) : Handler(ts.getDim()), _result(static_cast<Int64ResultNode &>(ts.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: Int64ResultNode & _result; }; class MultiValueHandler : public Handler { public: MultiValueHandler(ZCurveFunctionNode & ts) : Handler(ts.getDim()), _result(static_cast<IntegerResultNodeVector &>(ts.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: IntegerResultNodeVector & _result; }; - virtual bool onExecute() const; - virtual void onPrepareResult(); + bool onExecute() const override; + void onPrepareResult() override; Dimension _dim; std::unique_ptr<Handler> _handler; }; } } - diff --git a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp index 217217e3a5f..42d5b82b424 100644 --- a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.cpp @@ -1,18 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -#include <cmath> -LOG_SETUP(".features.euclidean_distance_feature"); -#include <vespa/searchcommon/attribute/attributecontent.h> -#include <vespa/searchcommon/attribute/iattributevector.h> -#include <vespa/searchlib/fef/properties.h> #include "valuefeature.h" - #include "euclidean_distance_feature.h" #include "array_parser.hpp" #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/attribute/floatbase.h> +#include <vespa/searchlib/fef/properties.h> +#include <vespa/searchcommon/attribute/attributecontent.h> +#include <cmath> + +#include <vespa/log/log.h> +LOG_SETUP(".features.euclidean_distance_feature"); using namespace search::attribute; using namespace search::fef; @@ -59,6 +57,8 @@ EuclideanDistanceBlueprint::EuclideanDistanceBlueprint() : { } +EuclideanDistanceBlueprint::~EuclideanDistanceBlueprint() {} + void EuclideanDistanceBlueprint::visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const { diff --git a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h index b2f6f72c7c5..e03079e0ba9 100644 --- a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h +++ b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h @@ -44,29 +44,16 @@ private: vespalib::string _queryVector; public: - /** - * Constructs a blueprint. - */ EuclideanDistanceBlueprint(); + ~EuclideanDistanceBlueprint(); - // Inherit doc from Blueprint. - virtual void visitDumpFeatures(const fef::IIndexEnvironment &env, - fef::IDumpFeatureVisitor &visitor) const override; - - // Inherit doc from Blueprint. - virtual fef::Blueprint::UP createInstance() const override; - - // Inherit doc from Blueprint. - virtual fef::ParameterDescriptions getDescriptions() const override { + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; + fef::Blueprint::UP createInstance() const override; + fef::ParameterDescriptions getDescriptions() const override { return fef::ParameterDescriptions().desc().attribute(fef::ParameterCollection::ANY).string(); } - - // Inherit doc from Blueprint. - virtual bool setup(const fef::IIndexEnvironment &env, - const fef::ParameterList ¶ms) override; - - // Inherit doc from Blueprint. - virtual fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; diff --git a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp index 3fd33589a66..033319cc778 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.cpp @@ -1,16 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".features.fieldmatchfeature"); #include "fieldmatchfeature.h" #include "utils.h" - -#include <vespa/searchlib/features/fieldmatch/computer.h> -#include <vespa/searchlib/features/fieldmatch/metrics.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/featurenamebuilder.h> -#include <vespa/searchlib/fef/fieldinfo.h> #include <vespa/searchlib/fef/indexproperties.h> #include <vespa/searchlib/fef/properties.h> #include <vespa/vespalib/util/stringfmt.h> diff --git a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h index 7ccc9b77206..83d2cb64bca 100644 --- a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h @@ -4,6 +4,7 @@ #include "nativerankfeature.h" #include "queryterm.h" +#include <vespa/fastos/dynamiclibrary.h> namespace search { namespace features { diff --git a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp index c53dbcc8288..bd9d22a9cd5 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.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 <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".features.tensor_factory_blueprint"); - #include "tensor_factory_blueprint.h" - #include <vespa/eval/eval/function.h> +#include <vespa/log/log.h> +LOG_SETUP(".features.tensor_factory_blueprint"); + using namespace search::fef; using vespalib::eval::Function; @@ -42,5 +40,7 @@ TensorFactoryBlueprint::TensorFactoryBlueprint(const vespalib::string &baseName) { } +TensorFactoryBlueprint::~TensorFactoryBlueprint() {} + } // namespace features } // namespace search diff --git a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h index 5d9ec8eafad..b8d8052ac0c 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h +++ b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h @@ -23,10 +23,11 @@ protected: bool extractSource(const vespalib::string &source); TensorFactoryBlueprint(const vespalib::string &baseName); + ~TensorFactoryBlueprint(); public: - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const override {} + void visitDumpFeatures(const search::fef::IIndexEnvironment &, + search::fef::IDumpFeatureVisitor &) const override {} }; } // namespace features diff --git a/searchlib/src/vespa/searchlib/features/valuefeature.cpp b/searchlib/src/vespa/searchlib/features/valuefeature.cpp index 884728aef69..0037779fb47 100644 --- a/searchlib/src/vespa/searchlib/features/valuefeature.cpp +++ b/searchlib/src/vespa/searchlib/features/valuefeature.cpp @@ -10,7 +10,6 @@ ValueExecutor::ValueExecutor(const std::vector<feature_t> & values) : search::fef::FeatureExecutor(), _values(values) { - // empty } void @@ -31,14 +30,14 @@ ValueBlueprint::ValueBlueprint() : search::fef::Blueprint("value"), _values() { - // empty } +ValueBlueprint::~ValueBlueprint() {} + void ValueBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &, search::fef::IDumpFeatureVisitor &) const { - // empty } bool diff --git a/searchlib/src/vespa/searchlib/features/valuefeature.h b/searchlib/src/vespa/searchlib/features/valuefeature.h index c92ad47b02e..9b4ca2583aa 100644 --- a/searchlib/src/vespa/searchlib/features/valuefeature.h +++ b/searchlib/src/vespa/searchlib/features/valuefeature.h @@ -2,11 +2,10 @@ #pragma once -#include <string> -#include <vector> #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/common/feature.h> +#include <vector> namespace search { namespace features { @@ -39,6 +38,7 @@ private: public: ValueBlueprint(); + ~ValueBlueprint(); void visitDumpFeatures(const fef::IIndexEnvironment & indexEnv, fef::IDumpFeatureVisitor & visitor) const override; diff --git a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp b/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp index fb5a2840497..23f79080cd3 100644 --- a/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp +++ b/searchlib/src/vespa/searchlib/fef/phrasesplitter.cpp @@ -78,9 +78,10 @@ PhraseSplitter::PhraseSplitter(const IQueryEnvironment & queryEnv, _copyInfo.push_back(meta); } } - } +PhraseSplitter::~PhraseSplitter() {} + void PhraseSplitter::copyTermFieldMatchData(TermFieldMatchData & dst, const TermFieldMatchData & src, uint32_t hitOffset) { diff --git a/searchlib/src/vespa/searchlib/fef/phrasesplitter.h b/searchlib/src/vespa/searchlib/fef/phrasesplitter.h index 9984ae7de3a..368cb2257f0 100644 --- a/searchlib/src/vespa/searchlib/fef/phrasesplitter.h +++ b/searchlib/src/vespa/searchlib/fef/phrasesplitter.h @@ -74,6 +74,7 @@ public: * @param field the field where we need to split phrases **/ PhraseSplitter(const IQueryEnvironment & queryEnv, uint32_t fieldId); + ~PhraseSplitter(); /** * Copy the source object to the destination object. diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.cpp b/searchlib/src/vespa/searchlib/fef/rank_program.cpp index 16051e018d4..1893ef52dc5 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.cpp +++ b/searchlib/src/vespa/searchlib/fef/rank_program.cpp @@ -161,6 +161,8 @@ RankProgram::RankProgram(BlueprintResolver::SP resolver) { } +RankProgram::~RankProgram() {} + void RankProgram::setup(const MatchDataLayout &mdl_in, const IQueryEnvironment &queryEnv, diff --git a/searchlib/src/vespa/searchlib/fef/rank_program.h b/searchlib/src/vespa/searchlib/fef/rank_program.h index b7552ee8e9e..c2cab182896 100644 --- a/searchlib/src/vespa/searchlib/fef/rank_program.h +++ b/searchlib/src/vespa/searchlib/fef/rank_program.h @@ -9,10 +9,9 @@ #include "matchdatalayout.h" #include "feature_resolver.h" #include <vespa/vespalib/stllike/string.h> -#include <vector> -#include <memory.h> #include <vespa/vespalib/util/array.h> #include <set> +#include <vector> namespace search { namespace fef { @@ -60,6 +59,7 @@ public: * @param resolver description on how to set up executors **/ RankProgram(BlueprintResolver::SP resolver); + ~RankProgram(); size_t num_executors() const { return _executors.size(); } diff --git a/searchlib/src/vespa/searchlib/fef/tablemanager.cpp b/searchlib/src/vespa/searchlib/fef/tablemanager.cpp index f62f24a3b0f..2707de9958f 100644 --- a/searchlib/src/vespa/searchlib/fef/tablemanager.cpp +++ b/searchlib/src/vespa/searchlib/fef/tablemanager.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 <vespa/fastos/fastos.h> #include "tablemanager.h" namespace search { @@ -13,6 +12,8 @@ TableManager::TableManager() : { } +TableManager::~TableManager() {} + const Table * TableManager::getTable(const vespalib::string & name) const { diff --git a/searchlib/src/vespa/searchlib/fef/tablemanager.h b/searchlib/src/vespa/searchlib/fef/tablemanager.h index e919ad0c7df..49fd35b2ff7 100644 --- a/searchlib/src/vespa/searchlib/fef/tablemanager.h +++ b/searchlib/src/vespa/searchlib/fef/tablemanager.h @@ -2,11 +2,11 @@ #pragma once -#include <map> -#include <vector> -#include <vespa/vespalib/util/sync.h> #include "itablefactory.h" #include "itablemanager.h" +#include <vespa/vespalib/util/sync.h> +#include <map> +#include <vector> namespace search { namespace fef { @@ -28,6 +28,7 @@ private: public: TableManager(); + ~TableManager(); /** * Adds a table factory to this manager. diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataarray.h b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataarray.h index c5da91d9193..23f180cdb5f 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataarray.h +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataarray.h @@ -4,6 +4,7 @@ #include <vector> #include <cassert> +#include <cstddef> namespace search { namespace fef { diff --git a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.h b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.h index 601d37bfe52..58f05a00d07 100644 --- a/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.h +++ b/searchlib/src/vespa/searchlib/fef/termfieldmatchdataposition.h @@ -3,6 +3,7 @@ #pragma once #include <vespa/searchlib/common/fslimits.h> +#include <cstdint> namespace search { namespace fef { @@ -106,4 +107,3 @@ public: } // namespace fef } // namespace search - diff --git a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp index c82d9e1e030..603ca65e246 100644 --- a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp +++ b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.cpp @@ -1,12 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fef.termmatchdatamerger"); #include "termmatchdatamerger.h" -#include <algorithm> - namespace search { namespace fef { @@ -29,6 +24,8 @@ TermMatchDataMerger::TermMatchDataMerger(const Inputs &allinputs, } } +TermMatchDataMerger::~TermMatchDataMerger() {} + void TermMatchDataMerger::merge(uint32_t docid) { diff --git a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.h b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.h index 6c1ae717a43..af00beb5e96 100644 --- a/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.h +++ b/searchlib/src/vespa/searchlib/fef/termmatchdatamerger.h @@ -37,6 +37,7 @@ public: TermMatchDataMerger(const Inputs &allinputs, const TermFieldMatchDataArray &outputs); + ~TermMatchDataMerger(); void merge(uint32_t docid); }; diff --git a/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp b/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp index 70f1fcf709d..3cabb6c4716 100644 --- a/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/featuretest.cpp @@ -1,16 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fef.featuretest"); -#include <sstream> #include "featuretest.h" #include <vespa/searchlib/fef/utils.h> #include <vespa/vespalib/testkit/test_kit.h> -namespace search { -namespace fef { -namespace test { +#include <vespa/log/log.h> +LOG_SETUP(".fef.featuretest"); + +namespace search::fef::test { FeatureTest::FeatureTest(BlueprintFactory &factory, const IndexEnvironment &indexEnv, @@ -28,9 +25,10 @@ FeatureTest::FeatureTest(BlueprintFactory &factory, _rankProgram(new RankProgram(_resolver)), _doneSetup(false) { - // empty } +FeatureTest::~FeatureTest() {} + FeatureTest::FeatureTest(BlueprintFactory &factory, const IndexEnvironment &indexEnv, QueryEnvironment &queryEnv, @@ -141,6 +139,4 @@ FeatureTest::clear() _doneSetup = false; } -} // namespace test -} // namespace fef -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/fef/test/featuretest.h b/searchlib/src/vespa/searchlib/fef/test/featuretest.h index 0c10bbf0c5f..4e35ef4f608 100644 --- a/searchlib/src/vespa/searchlib/fef/test/featuretest.h +++ b/searchlib/src/vespa/searchlib/fef/test/featuretest.h @@ -1,6 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "indexenvironment.h" +#include "indexenvironmentbuilder.h" +#include "matchdatabuilder.h" +#include "queryenvironment.h" +#include "queryenvironmentbuilder.h" +#include "rankresult.h" #include <vespa/searchlib/fef/blueprintfactory.h> #include <vespa/searchlib/fef/blueprintresolver.h> #include <vespa/searchlib/fef/fieldinfo.h> @@ -9,17 +15,9 @@ #include <vespa/searchlib/fef/matchdatalayout.h> #include <vespa/searchlib/fef/rank_program.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> -#include <vespa/searchlib/fef/test/indexenvironment.h> -#include <vespa/searchlib/fef/test/indexenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/matchdatabuilder.h> -#include <vespa/searchlib/fef/test/queryenvironment.h> -#include <vespa/searchlib/fef/test/queryenvironmentbuilder.h> -#include <vespa/searchlib/fef/test/rankresult.h> #include <vespa/eval/eval/value.h> -namespace search { -namespace fef { -namespace test { +namespace search::fef::test { /** * This class wraps everything necessary to simulate a feature execution environment. @@ -42,6 +40,7 @@ public: MatchDataLayout &layout, const std::vector<vespalib::string> &features, const Properties &overrides); + ~FeatureTest(); /** * Constructs a new feature test. @@ -123,7 +122,4 @@ private: void clear(); }; -} // namespace test -} // namespace fef -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp index 9df22f4c17f..1a359b4056e 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".ftlib"); -#include <boost/tokenizer.hpp> -#include <vespa/searchlib/features/utils.h> -#include <vespa/searchlib/fef/featurenamebuilder.h> -#include <vespa/vespalib/util/stringfmt.h> #include "ftlib.h" #include "dummy_dependency_handler.h" +#include <vespa/searchlib/features/utils.h> +#include <boost/tokenizer.hpp> + +#include <vespa/log/log.h> +LOG_SETUP(".ftlib"); using namespace search::features; using namespace search::fef; @@ -18,7 +16,6 @@ FtIndexEnvironment::FtIndexEnvironment() : search::fef::test::IndexEnvironment(), _builder(*this) { - // empty } FtQueryEnvironment::FtQueryEnvironment(search::fef::test::IndexEnvironment &env) @@ -26,7 +23,6 @@ FtQueryEnvironment::FtQueryEnvironment(search::fef::test::IndexEnvironment &env) _layout(), _builder(*this, _layout) { - // empty } FtQueryEnvironment::~FtQueryEnvironment() { } @@ -42,7 +38,6 @@ FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const vespa _overrides(), _test(factory, _indexEnv, _queryEnv, _queryEnv.getLayout(), feature, _overrides) { - // empty } FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector<vespalib::string> &features) @@ -53,6 +48,7 @@ FtFeatureTest::FtFeatureTest(search::fef::BlueprintFactory &factory, const std:: { } +FtFeatureTest::~FtFeatureTest() {} //--------------------------------------------------------------------------------------------------------------------- // FtUtil @@ -117,6 +113,7 @@ FtUtil::toRankResult(const vespalib::string & baseName, const vespalib::string & return retval; } +FtIndex::~FtIndex() {} //--------------------------------------------------------------------------------------------------------------------- // FtTestApp diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.h b/searchlib/src/vespa/searchlib/fef/test/ftlib.h index a88edc56eab..c73b2863381 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.h +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.h @@ -101,6 +101,7 @@ class FtFeatureTest { public: FtFeatureTest(search::fef::BlueprintFactory &factory, const vespalib::string &feature); FtFeatureTest(search::fef::BlueprintFactory &factory, const std::vector<vespalib::string> &features); + ~FtFeatureTest(); bool setup() { return _test.setup(); } bool execute(feature_t expected, double epsilon = 0, uint32_t docId = 1) { return _test.execute(expected, epsilon, docId); } @@ -170,6 +171,7 @@ struct FtIndex { FieldMap index; // raw content of all fields vespalib::string cursor; // last referenced field FtIndex() : index(), cursor() {} + ~FtIndex(); FtIndex &field(const vespalib::string &name) { cursor = name; index[name]; diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp index bfc2dd7fe05..13741cad990 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.cpp @@ -1,11 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fef.indexenvironment"); -#include <vespa/vespalib/util/stringfmt.h> -#include <vespa/searchlib/attribute/attributefactory.h> #include "indexenvironment.h" +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/vespalib/util/stringfmt.h> namespace search { namespace fef { @@ -30,6 +27,8 @@ IndexEnvironment::IndexEnvironment() : { } +IndexEnvironment::~IndexEnvironment() {} + const FieldInfo * IndexEnvironment::getField(uint32_t id) const { diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h index cdc5083b4b5..ee0c4269f35 100644 --- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h @@ -11,9 +11,7 @@ #include <string> #include <vector> -namespace search { -namespace fef { -namespace test { +namespace search::fef::test { /** * Implementation of the IIndexEnvironment interface used for testing. @@ -49,37 +47,19 @@ public: }; using ConstantsMap = std::map<vespalib::string, Constant>; - /** - * Constructs a new index environment. - */ - IndexEnvironment(); - - // Inherit doc from IIndexEnvironment. - virtual const Properties &getProperties() const override { return _properties; } - - // Inherit doc from IIndexEnvironment. - virtual uint32_t getNumFields() const override { return _fields.size(); } - - // Inherit doc from IIndexEnvironment. - virtual const FieldInfo *getField(uint32_t id) const override; - - // Inherit doc from IIndexEnvironment. - virtual const FieldInfo *getFieldByName(const string &name) const override; - - // Inherit doc from IIndexEnvironment. - virtual const ITableManager &getTableManager() const override { return _tableMan; } - // Inherit doc from IIndexEnvironment. - virtual FeatureMotivation getFeatureMotivation() const override { return UNKNOWN; } - - // Inherit doc from IIndexEnvironment. - virtual void hintFeatureMotivation(FeatureMotivation) const override {} - - // Inherit doc from IIndexEnvironment. - virtual void hintFieldAccess(uint32_t) const override {} - - // Inherit doc from IIndexEnvironment. - virtual void hintAttributeAccess(const string &) const override {} + IndexEnvironment(); + ~IndexEnvironment(); + + const Properties &getProperties() const override { return _properties; } + uint32_t getNumFields() const override { return _fields.size(); } + const FieldInfo *getField(uint32_t id) const override; + const FieldInfo *getFieldByName(const string &name) const override; + const ITableManager &getTableManager() const override { return _tableMan; } + FeatureMotivation getFeatureMotivation() const override { return UNKNOWN; } + void hintFeatureMotivation(FeatureMotivation) const override {} + void hintFieldAccess(uint32_t) const override {} + void hintAttributeAccess(const string &) const override {} /** Returns a reference to the properties map of this. */ Properties &getProperties() { return _properties; } @@ -114,7 +94,4 @@ private: ConstantsMap _constants; }; -} // namespace test -} // namespace fef -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp index 96c1a183f06..1f59cfb52b8 100644 --- a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.cpp @@ -1,21 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fef.matchdatabuilder"); -#include <vespa/vespalib/util/stringfmt.h> -#include <vespa/searchlib/attribute/attributeguard.h> -#include <vespa/searchlib/attribute/attributemanager.h> +#include "matchdatabuilder.h" #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attributevector.hpp> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/floatbase.h> #include <vespa/searchlib/attribute/stringbase.h> -#include "matchdatabuilder.h" -namespace search { -namespace fef { -namespace test { +#include <vespa/log/log.h> +LOG_SETUP(".fef.matchdatabuilder"); + +namespace search::fef::test { MatchDataBuilder::MatchDataBuilder(QueryEnvironment &queryEnv, MatchData &data) : _queryEnv(queryEnv), @@ -29,6 +22,8 @@ MatchDataBuilder::MatchDataBuilder(QueryEnvironment &queryEnv, MatchData &data) } } +MatchDataBuilder::~MatchDataBuilder() {} + TermFieldMatchData * MatchDataBuilder::getTermFieldMatchData(uint32_t termId, uint32_t fieldId) { @@ -176,6 +171,4 @@ MatchDataBuilder::apply(uint32_t docId) return true; } -} // namespace test -} // namespace fef -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h index 6efc335dd94..2018604a8ba 100644 --- a/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/matchdatabuilder.h @@ -1,14 +1,12 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "queryenvironment.h" +#include <vespa/searchlib/fef/matchdata.h> #include <memory> #include <set> -#include <vespa/searchlib/fef/matchdata.h> -#include "queryenvironment.h" -namespace search { -namespace fef { -namespace test { +namespace search::fef::test { class MatchDataBuilder { public: @@ -70,6 +68,7 @@ public: * @param data The match data to build in. */ MatchDataBuilder(QueryEnvironment &queryEnv, MatchData &data); + ~MatchDataBuilder(); /** * Returns the term field match data that corresponds to a given @@ -144,7 +143,4 @@ private: TermMap _match; }; -} // namespace test -} // namespace fef -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/grouping/groupandcollectengine.h b/searchlib/src/vespa/searchlib/grouping/groupandcollectengine.h index 4d1aa5a49df..8fa4dc8fa4a 100644 --- a/searchlib/src/vespa/searchlib/grouping/groupandcollectengine.h +++ b/searchlib/src/vespa/searchlib/grouping/groupandcollectengine.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/searchlib/grouping/groupengine.h> +#include "groupengine.h" namespace search { namespace grouping { @@ -12,9 +12,9 @@ public: GroupAndCollectEngine(const aggregation::GroupingLevel * request, size_t level, GroupEngine * nextEngine, bool frozen); ~GroupAndCollectEngine(); private: - virtual GroupRef group(Children & children, uint32_t docId, double rank); - virtual void group(uint32_t docId, double rank); - virtual GroupRef createGroup(const expression::ResultNode & id); + GroupRef group(Children & children, uint32_t docId, double rank) override; + void group(uint32_t docId, double rank) override; + GroupRef createGroup(const expression::ResultNode & id) override; }; } diff --git a/searchlib/src/vespa/searchlib/index/docbuilder.cpp b/searchlib/src/vespa/searchlib/index/docbuilder.cpp index d06b867c00d..167aee6b194 100644 --- a/searchlib/src/vespa/searchlib/index/docbuilder.cpp +++ b/searchlib/src/vespa/searchlib/index/docbuilder.cpp @@ -1,12 +1,7 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "docbuilder.h" -#include "doctypebuilder.h" -#include <vespa/document/datatype/annotationtype.h> -#include <vespa/document/datatype/datatypes.h> #include <vespa/document/datatype/urldatatype.h> -#include <vespa/document/fieldvalue/fieldvalues.h> -#include <vespa/document/repo/documenttyperepo.h> #include <vespa/fastlib/text/unicodeutil.h> #include <vespa/vespalib/geo/zcurve.h> #include <vespa/vespalib/text/utf8.h> @@ -653,6 +648,8 @@ DocBuilder::DocBuilder(const Schema &schema) { } +DocBuilder::~DocBuilder() {} + DocBuilder & DocBuilder::startDocument(const vespalib::string & docId) { diff --git a/searchlib/src/vespa/searchlib/index/docbuilder.h b/searchlib/src/vespa/searchlib/index/docbuilder.h index 5b82725daf9..fbda25c3e54 100644 --- a/searchlib/src/vespa/searchlib/index/docbuilder.h +++ b/searchlib/src/vespa/searchlib/index/docbuilder.h @@ -2,6 +2,7 @@ #pragma once +#include "doctypebuilder.h" #include <vespa/document/datatype/datatypes.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/annotation/annotation.h> @@ -11,7 +12,6 @@ #include <vespa/document/repo/documenttyperepo.h> #include <vespa/vespalib/util/exception.h> #include <vespa/vespalib/util/stringfmt.h> -#include "doctypebuilder.h" namespace vespalib { namespace tensor { class Tensor; } } namespace search { @@ -266,6 +266,7 @@ private: public: DocBuilder(const Schema & schema); + ~DocBuilder(); DocBuilder & startDocument(const vespalib::string & docId); document::Document::UP endDocument(); diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp index cedc0372cd9..c6530209b0b 100644 --- a/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp +++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.cpp @@ -166,12 +166,13 @@ DocTypeBuilder::UriField::markUsed(UsedFieldsMap &usedFields) const -DocTypeBuilder::SchemaIndexFields::SchemaIndexFields(void) +DocTypeBuilder::SchemaIndexFields::SchemaIndexFields() : _textFields(), _uriFields() { } +DocTypeBuilder::SchemaIndexFields::~SchemaIndexFields() {} void DocTypeBuilder::SchemaIndexFields::setup(const Schema &schema) diff --git a/searchlib/src/vespa/searchlib/index/doctypebuilder.h b/searchlib/src/vespa/searchlib/index/doctypebuilder.h index 1781d772122..d5f2b497b3a 100644 --- a/searchlib/src/vespa/searchlib/index/doctypebuilder.h +++ b/searchlib/src/vespa/searchlib/index/doctypebuilder.h @@ -2,18 +2,14 @@ #pragma once +#include <vespa/searchcommon/common/schema.h> #include <vespa/document/config/config-documenttypes.h> #include <vespa/document/datatype/datatypes.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/vespalib/util/exception.h> #include <vespa/vespalib/util/stringfmt.h> -#include <vespa/searchcommon/common/schema.h> - -namespace search -{ -namespace index -{ +namespace search::index { /** * Builder for the indexingdocument document type based on an index schema. @@ -36,32 +32,17 @@ public: uint32_t _hostname; private: - static void - markUsed(UsedFieldsMap &usedFields, - uint32_t field); - - static bool - valid(const Schema &schema, - uint32_t fieldId, - const Schema::CollectionType &collectionType); + static void markUsed(UsedFieldsMap &usedFields, uint32_t field); + static bool valid(const Schema &schema, uint32_t fieldId, + const Schema::CollectionType &collectionType); public: UriField(void); - bool - broken(const Schema &schema, - const Schema::CollectionType &collectionType) const; - - bool - valid(const Schema &schema, - const Schema::CollectionType &collectionType) const; - - void - setup(const Schema &schema, - const vespalib::string &field); - - void - markUsed(UsedFieldsMap &usedFields) const; + bool broken(const Schema &schema, const Schema::CollectionType &collectionType) const; + bool valid(const Schema &schema, const Schema::CollectionType &collectionType) const; + void setup(const Schema &schema, const vespalib::string &field); + void markUsed(UsedFieldsMap &usedFields) const; }; typedef std::vector<UriField> UriFieldIdVector; @@ -72,10 +53,9 @@ public: FieldIdVector _textFields; UriFieldIdVector _uriFields; - SchemaIndexFields(void); - - void - setup(const Schema &schema); + SchemaIndexFields(); + ~SchemaIndexFields(); + void setup(const Schema &schema); }; private: @@ -90,6 +70,4 @@ public: makeConfig(const document::DocumentType &docType); }; -} // namespace search::index -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp index 941a5fb3c40..d8a174b18fa 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp +++ b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.cpp @@ -23,6 +23,8 @@ PostingIterator::PostingIterator(Dictionary::PostingList::ConstIterator itr, _featureStore.setupForField(packedIndex, _featureDecoder); } +PostingIterator::~PostingIterator() {} + void PostingIterator::initRange(uint32_t begin, uint32_t end) { diff --git a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.h b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.h index 8b40984a710..77cbf9c10b6 100644 --- a/searchlib/src/vespa/searchlib/memoryindex/postingiterator.h +++ b/searchlib/src/vespa/searchlib/memoryindex/postingiterator.h @@ -31,6 +31,7 @@ public: const FeatureStore &featureStore, uint32_t packedIndex, const fef::TermFieldMatchDataArray &matchData); + ~PostingIterator(); void doSeek(uint32_t docId) override; void doUnpack(uint32_t docId) override; diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp index 60d4e6f9846..9ae4e412b8c 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.cpp @@ -3,7 +3,6 @@ #include "predicate_index.h" #include "predicate_hash.h" - using search::datastore::EntryRef; using vespalib::DataBuffer; using std::vector; @@ -87,6 +86,21 @@ public: PredicateIndex::PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, const DocIdLimitProvider &limit_provider, + const SimpleIndexConfig &simple_index_config, uint32_t arity) + : _arity(arity), + _generation_handler(generation_handler), + _limit_provider(limit_provider), + _interval_index(genHolder, limit_provider, simple_index_config), + _bounds_index(genHolder, limit_provider, simple_index_config), + _interval_store(), + _zero_constraint_docs(), + _features_store(arity), + _cache(genHolder) +{ +} + +PredicateIndex::PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, + const DocIdLimitProvider &limit_provider, const SimpleIndexConfig &simple_index_config, DataBuffer &buffer, SimpleIndexDeserializeObserver<> & observer, uint32_t version) : _arity(0), @@ -117,6 +131,8 @@ PredicateIndex::PredicateIndex(GenerationHandler &generation_handler, Generation commit(); } +PredicateIndex::~PredicateIndex() {} + void PredicateIndex::serialize(DataBuffer &buffer) const { _features_store.serialize(buffer); buffer.writeInt16(_arity); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_index.h b/searchlib/src/vespa/searchlib/predicate/predicate_index.h index f9aaf4ede0d..7444344cb38 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_index.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_index.h @@ -5,11 +5,11 @@ #include "document_features_store.h" #include "predicate_interval_store.h" #include "simple_index.h" +#include "predicate_interval.h" #include <vespa/searchlib/common/bitvectorcache.h> -#include <unordered_map> #include <vespa/vespalib/data/databuffer.h> #include <vespa/vespalib/stllike/string.h> -#include "predicate_interval.h" +#include <unordered_map> namespace search { namespace predicate { @@ -67,17 +67,7 @@ private: public: PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, const DocIdLimitProvider &limit_provider, - const SimpleIndexConfig &simple_index_config, uint32_t arity) - : _arity(arity), - _generation_handler(generation_handler), - _limit_provider(limit_provider), - _interval_index(genHolder, limit_provider, simple_index_config), - _bounds_index(genHolder, limit_provider, simple_index_config), - _interval_store(), - _zero_constraint_docs(), - _features_store(arity), - _cache(genHolder) { - } + const SimpleIndexConfig &simple_index_config, uint32_t arity); // deserializes PredicateIndex from buffer. // The observer can be used to gain some insight into what has been added to the index.. PredicateIndex(GenerationHandler &generation_handler, GenerationHolder &genHolder, @@ -85,6 +75,7 @@ public: const SimpleIndexConfig &simple_index_config, vespalib::DataBuffer &buffer, SimpleIndexDeserializeObserver<> & observer, uint32_t version); + ~PredicateIndex(); void serialize(vespalib::DataBuffer &buffer) const; void onDeserializationCompleted(); diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.cpp index 8c45b18c1e5..0ea905298a8 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.cpp @@ -1,18 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> - #include "predicate_tree_annotator.h" - #include "predicate_index.h" #include "predicate_range_expander.h" #include "predicate_tree_analyzer.h" -#include "tree_crumbs.h" #include <vespa/document/predicate/predicate.h> -#include "predicate_hash.h" -#include <vespa/vespalib/data/slime/slime.h> -#include <map> -#include <string> #include <vespa/log/log.h> LOG_SETUP(".predicate_tree_annotator"); @@ -236,6 +228,12 @@ void PredicateTreeAnnotatorImpl::assignIntervalMarkers(const Inspector &in) { } } // namespace + +PredicateTreeAnnotations::PredicateTreeAnnotations(uint32_t mf, uint16_t ir) + : min_feature(mf), interval_range(ir) +{} +PredicateTreeAnnotations::~PredicateTreeAnnotations(){} + void PredicateTreeAnnotator::annotate(const Inspector &in, PredicateTreeAnnotations &result, int64_t lower, int64_t upper) { diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.h b/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.h index a955d90411b..ed36ad957e8 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_tree_annotator.h @@ -3,16 +3,15 @@ #pragma once #include "predicate_interval.h" -#include <unordered_map> #include <vespa/vespalib/data/memory.h> #include <vespa/vespalib/stllike/string.h> #include <climits> #include <vector> +#include <unordered_map> -namespace vespalib { namespace slime { class Inspector; } } +namespace vespalib::slime { class Inspector; } -namespace search { -namespace predicate { +namespace search::predicate { struct RangeFeature { vespalib::Memory label; @@ -24,8 +23,8 @@ constexpr uint32_t MIN_INTERVAL = 0x0001; constexpr uint32_t MAX_INTERVAL = 0xffff; struct PredicateTreeAnnotations { - PredicateTreeAnnotations(uint32_t mf=0, uint16_t ir=MAX_INTERVAL) - : min_feature(mf), interval_range(ir) {} + PredicateTreeAnnotations(uint32_t mf=0, uint16_t ir=MAX_INTERVAL); + ~PredicateTreeAnnotations(); uint32_t min_feature; uint16_t interval_range; std::unordered_map<uint64_t, std::vector<Interval>> interval_map; @@ -47,5 +46,3 @@ struct PredicateTreeAnnotator { }; } // namespace predicate -} // namespace search - diff --git a/searchlib/src/vespa/searchlib/query/base.h b/searchlib/src/vespa/searchlib/query/base.h index 073a3c0ab3c..b9d3a7cfc33 100644 --- a/searchlib/src/vespa/searchlib/query/base.h +++ b/searchlib/src/vespa/searchlib/query/base.h @@ -49,7 +49,7 @@ typedef std::vector<DocumentIdT> DocumentIdList; #define NELEMS(a) (sizeof(a)/sizeof(a[0])) /// A macro used in descendants of Object to instantiate the duplicate method. -#define DUPLICATE(a) virtual a * duplicate() const; +#define DUPLICATE(a) a * duplicate() const override; #define IMPLEMENT_DUPLICATE(a) a * a::duplicate() const { return new a(*this); } /** diff --git a/searchlib/src/vespa/searchlib/query/queryterm.cpp b/searchlib/src/vespa/searchlib/query/queryterm.cpp index 2cd9c090210..77d0b7e9e23 100644 --- a/searchlib/src/vespa/searchlib/query/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/query/queryterm.cpp @@ -96,6 +96,11 @@ QueryTerm::QueryTerm() : _fieldInfo() { } +QueryTerm::QueryTerm(const QueryTerm &) = default; +QueryTerm & QueryTerm::operator = (const QueryTerm &) = default; +QueryTerm::QueryTerm(QueryTerm &&) = default; +QueryTerm & QueryTerm::operator = (QueryTerm &&) = default; + QueryTerm::~QueryTerm() { } void diff --git a/searchlib/src/vespa/searchlib/query/queryterm.h b/searchlib/src/vespa/searchlib/query/queryterm.h index 793b6b20596..97c6224572e 100644 --- a/searchlib/src/vespa/searchlib/query/queryterm.h +++ b/searchlib/src/vespa/searchlib/query/queryterm.h @@ -158,10 +158,10 @@ public: }; QueryTerm(); QueryTerm(std::unique_ptr<QueryNodeResultBase> resultBase, const string & term, const string & index, SearchTerm type); - QueryTerm(const QueryTerm &) = default; - QueryTerm & operator = (const QueryTerm &) = default; - QueryTerm(QueryTerm &&) = default; - QueryTerm & operator = (QueryTerm &&) = default; + QueryTerm(const QueryTerm &); + QueryTerm & operator = (const QueryTerm &); + QueryTerm(QueryTerm &&); + QueryTerm & operator = (QueryTerm &&); ~QueryTerm(); bool evaluate() const override; const HitList & evaluateHits(HitList & hl) const override; diff --git a/searchlib/src/vespa/searchlib/query/tree/customtypetermvisitor.h b/searchlib/src/vespa/searchlib/query/tree/customtypetermvisitor.h index ca58b6c1dce..7723216a1d2 100644 --- a/searchlib/src/vespa/searchlib/query/tree/customtypetermvisitor.h +++ b/searchlib/src/vespa/searchlib/query/tree/customtypetermvisitor.h @@ -2,8 +2,8 @@ #pragma once -#include <vespa/searchlib/query/tree/customtypevisitor.h> -#include <vespa/searchlib/query/tree/intermediate.h> +#include "customtypevisitor.h" +#include "intermediate.h" namespace search { namespace query { @@ -19,14 +19,14 @@ protected: } private: - virtual void visit(typename NodeTypes::And &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::AndNot &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::Equiv &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::Near &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::ONear &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::Or &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::Rank &n) { visitChildren(n); } - virtual void visit(typename NodeTypes::WeakAnd &n) { visitChildren(n); } + void visit(typename NodeTypes::And &n) override { visitChildren(n); } + void visit(typename NodeTypes::AndNot &n) override { visitChildren(n); } + void visit(typename NodeTypes::Equiv &n) override { visitChildren(n); } + void visit(typename NodeTypes::Near &n) override { visitChildren(n); } + void visit(typename NodeTypes::ONear &n) override { visitChildren(n); } + void visit(typename NodeTypes::Or &n) override { visitChildren(n); } + void visit(typename NodeTypes::Rank &n) override { visitChildren(n); } + void visit(typename NodeTypes::WeakAnd &n) override { visitChildren(n); } // phrases and weighted set terms are conceptual leaf nodes and // should be handled that way. @@ -34,4 +34,3 @@ private: } // namespace query } // namespace search - diff --git a/searchlib/src/vespa/searchlib/query/tree/customtypevisitor.h b/searchlib/src/vespa/searchlib/query/tree/customtypevisitor.h index ce1cff082b7..0a2c119c92d 100644 --- a/searchlib/src/vespa/searchlib/query/tree/customtypevisitor.h +++ b/searchlib/src/vespa/searchlib/query/tree/customtypevisitor.h @@ -75,31 +75,28 @@ private: typedef typename NodeTypes::PredicateQuery TPredicateQuery; typedef typename NodeTypes::RegExpTerm TRegExpTerm; - virtual void visit(And &n) { visit(static_cast<TAnd&>(n)); } - virtual void visit(AndNot &n) { visit(static_cast<TAndNot&>(n)); } - virtual void visit(Equiv &n) { visit(static_cast<TEquiv&>(n)); } - virtual void visit(NumberTerm &n) { visit(static_cast<TNumberTerm&>(n)); } - virtual void visit(LocationTerm &n) { visit(static_cast<TLocTrm&>(n)); } - virtual void visit(Near &n) { visit(static_cast<TNear&>(n)); } - virtual void visit(ONear &n) { visit(static_cast<TONear&>(n)); } - virtual void visit(Or &n) { visit(static_cast<TOr&>(n)); } - virtual void visit(Phrase &n) { visit(static_cast<TPhrase&>(n)); } - virtual void visit(PrefixTerm &n) { visit(static_cast<TPrefixTerm&>(n)); } - virtual void visit(RangeTerm &n) { visit(static_cast<TRangeTerm&>(n)); } - virtual void visit(Rank &n) { visit(static_cast<TRank&>(n)); } - virtual void visit(StringTerm &n) { visit(static_cast<TStringTerm&>(n)); } - virtual void visit(SubstringTerm &n) { visit(static_cast<TSubstrTr&>(n)); } - virtual void visit(SuffixTerm &n) { visit(static_cast<TSuffixTerm&>(n)); } - virtual void visit(WeakAnd &n) { visit(static_cast<TWeakAnd&>(n)); } - virtual void visit(WeightedSetTerm &n) - { visit(static_cast<TWeightedSetTerm&>(n)); } - virtual void visit(DotProduct &n) { visit(static_cast<TDotProduct&>(n)); } - virtual void visit(WandTerm &n) { visit(static_cast<TWandTerm&>(n)); } - virtual void visit(PredicateQuery &n) - { visit(static_cast<TPredicateQuery&>(n)); } - virtual void visit(RegExpTerm &n) { visit(static_cast<TRegExpTerm&>(n)); } + void visit(And &n) override { visit(static_cast<TAnd&>(n)); } + void visit(AndNot &n) override { visit(static_cast<TAndNot&>(n)); } + void visit(Equiv &n) override { visit(static_cast<TEquiv&>(n)); } + void visit(NumberTerm &n) override { visit(static_cast<TNumberTerm&>(n)); } + void visit(LocationTerm &n) override { visit(static_cast<TLocTrm&>(n)); } + void visit(Near &n) override { visit(static_cast<TNear&>(n)); } + void visit(ONear &n) override { visit(static_cast<TONear&>(n)); } + void visit(Or &n) override { visit(static_cast<TOr&>(n)); } + void visit(Phrase &n) override { visit(static_cast<TPhrase&>(n)); } + void visit(PrefixTerm &n) override { visit(static_cast<TPrefixTerm&>(n)); } + void visit(RangeTerm &n) override { visit(static_cast<TRangeTerm&>(n)); } + void visit(Rank &n) override { visit(static_cast<TRank&>(n)); } + void visit(StringTerm &n) override { visit(static_cast<TStringTerm&>(n)); } + void visit(SubstringTerm &n) override { visit(static_cast<TSubstrTr&>(n)); } + void visit(SuffixTerm &n) override { visit(static_cast<TSuffixTerm&>(n)); } + void visit(WeakAnd &n) override { visit(static_cast<TWeakAnd&>(n)); } + void visit(WeightedSetTerm &n) override { visit(static_cast<TWeightedSetTerm&>(n)); } + void visit(DotProduct &n) override { visit(static_cast<TDotProduct&>(n)); } + void visit(WandTerm &n) override { visit(static_cast<TWandTerm&>(n)); } + void visit(PredicateQuery &n) override { visit(static_cast<TPredicateQuery&>(n)); } + void visit(RegExpTerm &n) override { visit(static_cast<TRegExpTerm&>(n)); } }; } // namespace query } // namespace search - diff --git a/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h b/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h index 38f666cb155..a2f41b872a8 100644 --- a/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h +++ b/searchlib/src/vespa/searchlib/query/tree/queryreplicator.h @@ -33,64 +33,64 @@ private: } } - virtual void visit(And &node) { + void visit(And &node) override { _builder.addAnd(node.getChildren().size()); visitNodes(node.getChildren()); } - virtual void visit(AndNot &node) { + void visit(AndNot &node) override { _builder.addAndNot(node.getChildren().size()); visitNodes(node.getChildren()); } - virtual void visit(WeakAnd &node) { + void visit(WeakAnd &node) override { _builder.addWeakAnd(node.getChildren().size(), node.getMinHits(), node.getView()); visitNodes(node.getChildren()); } - virtual void visit(Equiv &node) { + void visit(Equiv &node) override { _builder.addEquiv(node.getChildren().size(), node.getId(), node.getWeight()) .setTermIndex(node.getTermIndex()); visitNodes(node.getChildren()); } - virtual void visit(Near &node) { + void visit(Near &node) override { _builder.addNear(node.getChildren().size(), node.getDistance()); visitNodes(node.getChildren()); } - virtual void visit(ONear &node) { + void visit(ONear &node) override { _builder.addONear(node.getChildren().size(), node.getDistance()); visitNodes(node.getChildren()); } - virtual void visit(Or &node) { + void visit(Or &node) override { _builder.addOr(node.getChildren().size()); visitNodes(node.getChildren()); } - virtual void visit(Phrase &node) { + void visit(Phrase &node) override { replicate(node, _builder.addPhrase(node.getChildren().size(), node.getView(), node.getId(), node.getWeight())); visitNodes(node.getChildren()); } - virtual void visit(WeightedSetTerm &node) { + void visit(WeightedSetTerm &node) override { replicate(node, _builder.addWeightedSetTerm(node.getChildren().size(), node.getView(), node.getId(), node.getWeight())); visitNodes(node.getChildren()); } - virtual void visit(DotProduct &node) { + void visit(DotProduct &node) override { replicate(node, _builder.addDotProduct(node.getChildren().size(), node.getView(), node.getId(), node.getWeight())); visitNodes(node.getChildren()); } - virtual void visit(WandTerm &node) { + void visit(WandTerm &node) override { replicate(node, _builder.addWandTerm(node.getChildren().size(), node.getView(), node.getId(), node.getWeight(), @@ -100,7 +100,7 @@ private: visitNodes(node.getChildren()); } - virtual void visit(Rank &node) { + void visit(Rank &node) override { _builder.addRank(node.getChildren().size()); visitNodes(node.getChildren()); } @@ -110,56 +110,55 @@ private: replica.setRanked(original.isRanked()); } - virtual void visit(NumberTerm &node) { + void visit(NumberTerm &node) override { replicate(node, _builder.addNumberTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(LocationTerm &node) { + void visit(LocationTerm &node) override { replicate(node,_builder.addLocationTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(PrefixTerm &node) { + void visit(PrefixTerm &node) override { replicate(node, _builder.addPrefixTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(RangeTerm &node) { + void visit(RangeTerm &node) override { replicate(node, _builder.addRangeTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(StringTerm &node) { + void visit(StringTerm &node) override { replicate(node, _builder.addStringTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(SubstringTerm &node) { + void visit(SubstringTerm &node) override { replicate(node, _builder.addSubstringTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(SuffixTerm &node) { + void visit(SuffixTerm &node) override { replicate(node, _builder.addSuffixTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(PredicateQuery &node) { + void visit(PredicateQuery &node) override { replicate(node, _builder.addPredicateQuery( - PredicateQueryTerm::UP(new PredicateQueryTerm( - *node.getTerm())), + PredicateQueryTerm::UP(new PredicateQueryTerm(*node.getTerm())), node.getView(), node.getId(), node.getWeight())); } - virtual void visit(RegExpTerm &node) { + void visit(RegExpTerm &node) override { replicate(node, _builder.addRegExpTerm( node.getTerm(), node.getView(), node.getId(), node.getWeight())); @@ -168,4 +167,3 @@ private: } // namespace query } // namespace search - diff --git a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h index c00f80719a1..c22787ec3b8 100644 --- a/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h +++ b/searchlib/src/vespa/searchlib/query/tree/stackdumpquerycreator.h @@ -45,7 +45,7 @@ public: LOG(error, "Raw QueryStack = %s", vespalib::HexDump(stack.c_str(), stack.size()).toString().c_str()); if (LOG_WOULD_LOG(debug)) { vespalib::string query = SimpleQueryStack::StackbufToString(stack); - LOG(error, "QueryStack = %s", builder.error().c_str(), query.c_str()); + LOG(error, "Error = %s, QueryStack = %s", builder.error().c_str(), query.c_str()); } } return builder.build(); diff --git a/searchlib/src/vespa/searchlib/query/tree/templatetermvisitor.h b/searchlib/src/vespa/searchlib/query/tree/templatetermvisitor.h index fc11856f564..f05e2dab980 100644 --- a/searchlib/src/vespa/searchlib/query/tree/templatetermvisitor.h +++ b/searchlib/src/vespa/searchlib/query/tree/templatetermvisitor.h @@ -2,7 +2,7 @@ #pragma once -#include <vespa/searchlib/query/tree/customtypetermvisitor.h> +#include "customtypetermvisitor.h" namespace search { namespace query { @@ -23,37 +23,36 @@ class TemplateTermVisitor : public CustomTypeTermVisitor<NodeTypes> { static_cast<Self &>(*this).template visitTerm(n); } - virtual void visit(typename NodeTypes::NumberTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::LocationTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::PrefixTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::RangeTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::StringTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::SubstringTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::SuffixTerm &n) { myVisit(n); } - virtual void visit(typename NodeTypes::PredicateQuery &n) { myVisit(n); } - virtual void visit(typename NodeTypes::RegExpTerm &n) { myVisit(n); } + void visit(typename NodeTypes::NumberTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::LocationTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::PrefixTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::RangeTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::StringTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::SubstringTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::SuffixTerm &n) override { myVisit(n); } + void visit(typename NodeTypes::PredicateQuery &n) override { myVisit(n); } + void visit(typename NodeTypes::RegExpTerm &n) override { myVisit(n); } // Phrases are terms with children. This visitor will not visit // the phrase's children, unless this member function is // overridden to do so. - virtual void visit(typename NodeTypes::Phrase &n) { myVisit(n); } + void visit(typename NodeTypes::Phrase &n) override { myVisit(n); } // WeightedSetTerms are terms with children. This visitor will not visit // the weighted set's children, unless this member function is // overridden to do so. - virtual void visit(typename NodeTypes::WeightedSetTerm &n) { myVisit(n); } + void visit(typename NodeTypes::WeightedSetTerm &n) override { myVisit(n); } // DotProducts have children. This visitor will not visit the dot // product's children, unless this member function is overridden // to do so. - virtual void visit(typename NodeTypes::DotProduct &n) { myVisit(n); } + void visit(typename NodeTypes::DotProduct &n) override { myVisit(n); } // WandTerms have children. This visitor will not visit the wand // term's children, unless this member function is overridden // to do so. - virtual void visit(typename NodeTypes::WandTerm &n) { myVisit(n); } + void visit(typename NodeTypes::WandTerm &n) override { myVisit(n); } }; } // namespace query } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h index b317c9094f1..31600208ecf 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h @@ -2,18 +2,19 @@ #pragma once +#include "field_spec.h" #include <vespa/searchlib/fef/handle.h> #include <vespa/searchlib/fef/matchdata.h> #include <vespa/searchlib/fef/termfieldmatchdata.h> #include <vespa/searchlib/fef/termfieldmatchdataarray.h> + +#include <vespa/searchlib/queryeval/searchiterator.h> +#include <vespa/searchlib/queryeval/multisearch.h> +#include <vespa/searchlib/queryeval/unpackinfo.h> #include <vespa/vespalib/util/array.h> #include <vespa/vespalib/stllike/hash_map.h> #include <vector> #include <memory> -#include <vespa/searchlib/queryeval/searchiterator.h> -#include <vespa/searchlib/queryeval/multisearch.h> -#include <vespa/searchlib/queryeval/unpackinfo.h> -#include "field_spec.h" namespace vespalib { class ObjectVisitor; }; diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp index 74b7464ea3f..dcd35b1ec64 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.cpp @@ -1,13 +1,27 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// $Id$ -#include <vespa/fastos/fastos.h> + #include "create_blueprint_visitor_helper.h" -#include <vespa/searchlib/queryeval/leaf_blueprints.h> +#include "leaf_blueprints.h" +#include "dot_product_blueprint.h" +#include "get_weight_from_node.h" +#include "wand/parallel_weak_and_blueprint.h" +#include "simple_phrase_blueprint.h" +#include "weighted_set_term_blueprint.h" +#include "split_float.h" namespace search { namespace queryeval { +CreateBlueprintVisitorHelper::CreateBlueprintVisitorHelper(Searchable &searchable, const FieldSpec &field, const IRequestContext & requestContext) + : _requestContext(requestContext), + _searchable(searchable), + _field(field), + _result() +{} + +CreateBlueprintVisitorHelper::~CreateBlueprintVisitorHelper() {} + Blueprint::UP CreateBlueprintVisitorHelper::getResult() { @@ -16,5 +30,74 @@ CreateBlueprintVisitorHelper::getResult() : Blueprint::UP(new EmptyBlueprint(_field)); } +void +CreateBlueprintVisitorHelper::visitPhrase(search::query::Phrase &n) { + SimplePhraseBlueprint *phrase = new SimplePhraseBlueprint(_field, _requestContext); + Blueprint::UP result(phrase); + for (size_t i = 0; i < n.getChildren().size(); ++i) { + FieldSpecList fields; + fields.add(phrase->getNextChildField(_field)); + phrase->addTerm(_searchable.createBlueprint(_requestContext, fields, *n.getChildren()[i])); + } + setResult(std::move(result)); +} + +void +CreateBlueprintVisitorHelper::handleNumberTermAsText(search::query::NumberTerm &n) +{ + vespalib::string termStr = termAsString(n); + queryeval::SplitFloat splitter(termStr); + if (splitter.parts() > 1) { + query::SimplePhrase phraseNode(n.getView(), n.getId(), n.getWeight()); + phraseNode.setStateFrom(n); + for (size_t i = 0; i < splitter.parts(); ++i) { + query::Node::UP nn; + nn.reset(new query::SimpleStringTerm(splitter.getPart(i), "", 0, query::Weight(0))); + phraseNode.append(std::move(nn)); + } + visitPhrase(phraseNode); + } else { + if (splitter.parts() == 1) { + termStr = splitter.getPart(0); + } + query::SimpleStringTerm stringNode(termStr, n.getView(), n.getId(), n.getWeight()); + stringNode.setStateFrom(n); + visit(stringNode); + } +} + +template <typename WS, typename NODE> +void +CreateBlueprintVisitorHelper::createWeightedSet(WS *bp, NODE &n) { + Blueprint::UP result(bp); + FieldSpecList fields; + for (size_t i = 0; i < n.getChildren().size(); ++i) { + fields.clear(); + fields.add(bp->getNextChildField(_field)); + const search::query::Node &node = *n.getChildren()[i]; + uint32_t weight = getWeightFromNode(node).percent(); + bp->addTerm(_searchable.createBlueprint(_requestContext, fields, node), weight); + } + setResult(std::move(result)); +} +void +CreateBlueprintVisitorHelper::visitWeightedSetTerm(search::query::WeightedSetTerm &n) { + WeightedSetTermBlueprint *bp = new WeightedSetTermBlueprint(_field); + createWeightedSet(bp, n); +} +void +CreateBlueprintVisitorHelper::visitDotProduct(search::query::DotProduct &n) { + DotProductBlueprint *bp = new DotProductBlueprint(_field); + createWeightedSet(bp, n); +} +void +CreateBlueprintVisitorHelper::visitWandTerm(search::query::WandTerm &n) { + ParallelWeakAndBlueprint *bp = new ParallelWeakAndBlueprint(_field, + n.getTargetNumHits(), + n.getScoreThreshold(), + n.getThresholdBoostFactor()); + createWeightedSet(bp, n); +} + } // namespace search::queryeval } // namespace search diff --git a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h index 3d99b55f414..79d01bc2d8f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h +++ b/searchlib/src/vespa/searchlib/queryeval/create_blueprint_visitor_helper.h @@ -2,14 +2,8 @@ #pragma once -#include "dot_product_blueprint.h" -#include "get_weight_from_node.h" -#include "wand/parallel_weak_and_blueprint.h" #include "searchable.h" -#include "simple_phrase_blueprint.h" -#include "split_float.h" #include "termasstring.h" -#include "weighted_set_term_blueprint.h" #include <vespa/searchlib/query/tree/intermediatenodes.h> #include <vespa/searchlib/query/tree/queryvisitor.h> #include <vespa/searchlib/query/tree/termnodes.h> @@ -31,12 +25,8 @@ protected: const IRequestContext & getRequestContext() const { return _requestContext; } public: - CreateBlueprintVisitorHelper(Searchable &searchable, const FieldSpec &field, const IRequestContext & requestContext) : - _requestContext(requestContext), - _searchable(searchable), - _field(field), - _result() - {} + CreateBlueprintVisitorHelper(Searchable &searchable, const FieldSpec &field, const IRequestContext & requestContext); + ~CreateBlueprintVisitorHelper(); template <typename T> std::unique_ptr<T> make_UP(T *p) { return std::unique_ptr<T>(p); } @@ -48,68 +38,15 @@ public: const FieldSpec &getField() const { return _field; } - void visitPhrase(search::query::Phrase &n) { - SimplePhraseBlueprint *phrase = new SimplePhraseBlueprint(_field, _requestContext); - Blueprint::UP result(phrase); - for (size_t i = 0; i < n.getChildren().size(); ++i) { - FieldSpecList fields; - fields.add(phrase->getNextChildField(_field)); - phrase->addTerm(_searchable.createBlueprint(_requestContext, fields, *n.getChildren()[i])); - } - setResult(std::move(result)); - } + void visitPhrase(search::query::Phrase &n); template <typename WS, typename NODE> - void createWeightedSet(WS *bp, NODE &n) { - Blueprint::UP result(bp); - FieldSpecList fields; - for (size_t i = 0; i < n.getChildren().size(); ++i) { - fields.clear(); - fields.add(bp->getNextChildField(_field)); - const search::query::Node &node = *n.getChildren()[i]; - uint32_t weight = getWeightFromNode(node).percent(); - bp->addTerm(_searchable.createBlueprint(_requestContext, fields, node), weight); - } - setResult(std::move(result)); - } - void visitWeightedSetTerm(search::query::WeightedSetTerm &n) { - WeightedSetTermBlueprint *bp = new WeightedSetTermBlueprint(_field); - createWeightedSet(bp, n); - } - void visitDotProduct(search::query::DotProduct &n) { - DotProductBlueprint *bp = new DotProductBlueprint(_field); - createWeightedSet(bp, n); - } - void visitWandTerm(search::query::WandTerm &n) { - ParallelWeakAndBlueprint *bp = new ParallelWeakAndBlueprint(_field, - n.getTargetNumHits(), - n.getScoreThreshold(), - n.getThresholdBoostFactor()); - createWeightedSet(bp, n); - } + void createWeightedSet(WS *bp, NODE &n); + void visitWeightedSetTerm(search::query::WeightedSetTerm &n); + void visitDotProduct(search::query::DotProduct &n); + void visitWandTerm(search::query::WandTerm &n); - void handleNumberTermAsText(search::query::NumberTerm &n) - { - vespalib::string termStr = termAsString(n); - queryeval::SplitFloat splitter(termStr); - if (splitter.parts() > 1) { - query::SimplePhrase phraseNode(n.getView(), n.getId(), n.getWeight()); - phraseNode.setStateFrom(n); - for (size_t i = 0; i < splitter.parts(); ++i) { - query::Node::UP nn; - nn.reset(new query::SimpleStringTerm(splitter.getPart(i), "", 0, query::Weight(0))); - phraseNode.append(std::move(nn)); - } - visitPhrase(phraseNode); - } else { - if (splitter.parts() == 1) { - termStr = splitter.getPart(0); - } - query::SimpleStringTerm stringNode(termStr, n.getView(), n.getId(), n.getWeight()); - stringNode.setStateFrom(n); - visit(stringNode); - } - } + void handleNumberTermAsText(search::query::NumberTerm &n); void illegalVisit() {} diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp index 65b1257b105..4dcc2b213d7 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp @@ -9,11 +9,9 @@ #include "sourceblendersearch.h" #include "equivsearch.h" #include "termwise_blueprint_helper.h" -#include "termwise_search.h" #include "isourceselector.h" #include <vespa/searchlib/queryeval/wand/weak_and_search.h> - namespace search { namespace queryeval { @@ -305,6 +303,7 @@ OrBlueprint::createIntermediateSearch(const MultiSearch::Children &subSearches, } //----------------------------------------------------------------------------- +WeakAndBlueprint::~WeakAndBlueprint() {} Blueprint::HitEstimate WeakAndBlueprint::combine(const std::vector<HitEstimate> &data) const diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h index 9f577297f94..0a164221c65 100644 --- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h +++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h @@ -82,6 +82,7 @@ public: bool strict, fef::MatchData &md) const override; WeakAndBlueprint(uint32_t n) : _n(n) {} + ~WeakAndBlueprint(); void addTerm(Blueprint::UP bp, uint32_t weight) { addChild(std::move(bp)); _weights.push_back(weight); diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp index be282a29cdf..d12cd2f141c 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.cpp @@ -1,10 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> + #include "monitoring_search_iterator.h" -#include <vespa/vespalib/objects/objectvisitor.h> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/log/log.h> LOG_SETUP(".queryeval.monitoring_search_iterator"); using vespalib::make_string; @@ -81,6 +80,8 @@ MonitoringSearchIterator::Dumper::Dumper(int indent, { } +MonitoringSearchIterator::Dumper::~Dumper() {} + void MonitoringSearchIterator::Dumper::openStruct(const vespalib::string &name, const vespalib::string &type) { @@ -187,6 +188,8 @@ MonitoringSearchIterator::MonitoringSearchIterator(const vespalib::string &name, { } +MonitoringSearchIterator::~MonitoringSearchIterator() {} + void MonitoringSearchIterator::doSeek(uint32_t docId) { @@ -236,4 +239,3 @@ MonitoringSearchIterator::visitMembers(vespalib::ObjectVisitor &visitor) const } // namespace queryeval } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h index c0b3c9a9ff6..98807c5ff42 100644 --- a/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h +++ b/searchlib/src/vespa/searchlib/queryeval/monitoring_search_iterator.h @@ -78,6 +78,7 @@ public: uint32_t intFormatWidth = 1, uint32_t floatFormatWidth = 1, uint32_t floatFormatPrecision = 2); + ~Dumper(); vespalib::string toString() const { return _str; } @@ -105,6 +106,7 @@ public: MonitoringSearchIterator(const vespalib::string &name, SearchIterator::UP search, bool collectHitSkipStats); + ~MonitoringSearchIterator(); // Overrides SearchIterator void doSeek(uint32_t docId) override; diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp index 0797451b4fe..e1b03590eed 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.cpp @@ -204,6 +204,8 @@ PredicateBlueprint::PredicateBlueprint(const FieldSpecBase &field, } } +PredicateBlueprint::~PredicateBlueprint() {} + namespace { template<typename DictEntry, typename VectorIteratorEntry, typename BTreeIteratorEntry> diff --git a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h index d8be2e45b54..13d53c187b3 100644 --- a/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/predicate_blueprint.h @@ -48,6 +48,7 @@ public: const PredicateAttribute & attribute, const query::PredicateQuery &query); + ~PredicateBlueprint(); void fetchPostings(bool strict) override; SearchIterator::UP diff --git a/searchlib/src/vespa/searchlib/queryeval/test/eagerchild.h b/searchlib/src/vespa/searchlib/queryeval/test/eagerchild.h index d6404842b39..a9e3386af56 100644 --- a/searchlib/src/vespa/searchlib/queryeval/test/eagerchild.h +++ b/searchlib/src/vespa/searchlib/queryeval/test/eagerchild.h @@ -13,8 +13,8 @@ namespace test { struct EagerChild : public SearchIterator { EagerChild(uint32_t initial) : SearchIterator() { setDocId(initial); } - virtual void doSeek(uint32_t) { setAtEnd(); } - virtual void doUnpack(uint32_t) {} + void doSeek(uint32_t) override { setAtEnd(); } + void doUnpack(uint32_t) override {} }; } // namespace test diff --git a/searchlib/src/vespa/searchlib/queryeval/test/leafspec.h b/searchlib/src/vespa/searchlib/queryeval/test/leafspec.h index 5fb03c4afa2..cad78b8e792 100644 --- a/searchlib/src/vespa/searchlib/queryeval/test/leafspec.h +++ b/searchlib/src/vespa/searchlib/queryeval/test/leafspec.h @@ -7,9 +7,7 @@ #include <vespa/searchlib/queryeval/searchiterator.h> #include <string> -namespace search { -namespace queryeval { -namespace test { +namespace search::queryeval::test { /** * Defines the hits to be returned by a wand-like subsearch and creates a TrackedSearch. @@ -28,6 +26,7 @@ struct LeafSpec result(), search() {} + ~LeafSpec() {} LeafSpec &doc(uint32_t docid) { result.doc(docid); return *this; @@ -55,7 +54,4 @@ struct LeafSpec } }; -} // namespace test -} // namespace queryeval -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/queryeval/test/searchhistory.h b/searchlib/src/vespa/searchlib/queryeval/test/searchhistory.h index 3e528e9a370..5adceb0203f 100644 --- a/searchlib/src/vespa/searchlib/queryeval/test/searchhistory.h +++ b/searchlib/src/vespa/searchlib/queryeval/test/searchhistory.h @@ -19,6 +19,7 @@ struct SearchHistory { uint32_t docid; Entry(const std::string &t, const std::string &o, uint32_t id) : target(t), op(o), docid(id) {} + ~Entry() {} bool operator==(const Entry &rhs) const { return ((target == rhs.target) && (op == rhs.op) && diff --git a/searchlib/src/vespa/searchlib/queryeval/test/trackedsearch.h b/searchlib/src/vespa/searchlib/queryeval/test/trackedsearch.h index 49e3fd6b84a..33dbfec5bcc 100644 --- a/searchlib/src/vespa/searchlib/queryeval/test/trackedsearch.h +++ b/searchlib/src/vespa/searchlib/queryeval/test/trackedsearch.h @@ -7,9 +7,7 @@ #include <vespa/searchlib/queryeval/searchiterator.h> #include <string> -namespace search { -namespace queryeval { -namespace test { +namespace search::queryeval::test { /** * Proxy and wrapper for FakeSearch to track search history and @@ -31,13 +29,13 @@ private: } protected: - virtual void doSeek(uint32_t docid) { + void doSeek(uint32_t docid) override { _history.seek(_name, docid); _search->seek(docid); setDocId(_search->getDocId()); _history.step(_name, getDocId()); } - virtual void doUnpack(uint32_t docid) { + void doUnpack(uint32_t docid) override { _history.unpack(_name, docid); _search->unpack(docid); } @@ -63,12 +61,9 @@ public: : _name(name), _history(hist), _matchData(), _search(search), _minMaxPostingInfo() { setDocId(_search->getDocId()); } - virtual const PostingInfo *getPostingInfo() const { + const PostingInfo *getPostingInfo() const override { return _minMaxPostingInfo.get(); } }; -} // namespace test -} // namespace queryeval -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/queryeval/test/wandspec.h b/searchlib/src/vespa/searchlib/queryeval/test/wandspec.h index a578d1d908d..3951f1ca888 100644 --- a/searchlib/src/vespa/searchlib/queryeval/test/wandspec.h +++ b/searchlib/src/vespa/searchlib/queryeval/test/wandspec.h @@ -9,9 +9,7 @@ #include <vespa/searchlib/queryeval/wand/wand_parts.h> #include <vector> -namespace search { -namespace queryeval { -namespace test { +namespace search::queryeval::test { /** * Defines the overall behavior of a wand like search with tracked children. @@ -27,6 +25,7 @@ private: public: WandSpec() : _leafs(), _layout(), _handles(), _history() {} + ~WandSpec() {} WandSpec &leaf(const LeafSpec &l) { _leafs.push_back(l); _handles.push_back(_layout.allocTermField(0)); @@ -47,7 +46,4 @@ public: fef::MatchData::UP createMatchData() const { return _layout.createMatchData(); } }; -} // namespace test -} // namespace queryeval -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.cpp b/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.cpp index 594035af760..0b25d954e74 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.cpp +++ b/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.cpp @@ -1,20 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -#include <vespa/searchlib/bitcompression/compression.h> -#include <vespa/searchlib/bitcompression/countcompression.h> -#include <vespa/searchlib/index/postinglistcounts.h> #include "threelevelcountbuffers.h" -LOG_SETUP(".threelevelcountbuffers"); - -namespace search -{ - -namespace diskindex -{ - +namespace search::diskindex { ThreeLevelCountWriteBuffers:: ThreeLevelCountWriteBuffers(EC &sse, EC &spe, EC &pe) @@ -77,10 +65,7 @@ ThreeLevelCountWriteBuffers::startPad(uint32_t ssHeaderLen, } -ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, - DC &spd, - DC &pd, - ThreeLevelCountWriteBuffers &wb) +ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, DC &spd, DC &pd, ThreeLevelCountWriteBuffers &wb) : _ssd(ssd), _spd(spd), _pd(pd), @@ -106,9 +91,7 @@ ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, } -ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, - DC &spd, - DC &pd) +ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, DC &spd, DC &pd) : _ssd(ssd), _spd(spd), _pd(pd), @@ -127,7 +110,6 @@ ThreeLevelCountReadBuffers::ThreeLevelCountReadBuffers(DC &ssd, pd.setReadContext(&_rcpd); } +ThreeLevelCountReadBuffers::~ThreeLevelCountReadBuffers() {} -} // namespace diskindex - -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.h b/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.h index cf7f5adc791..a7fe87d83bf 100644 --- a/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.h +++ b/searchlib/src/vespa/searchlib/test/diskindex/threelevelcountbuffers.h @@ -2,14 +2,10 @@ #pragma once -#include <limits> #include <vespa/searchlib/bitcompression/countcompression.h> +#include <limits> -namespace search -{ - -namespace diskindex -{ +namespace search::diskindex { class ThreeLevelCountWriteBuffers { @@ -64,19 +60,11 @@ public: uint64_t _pFileBitSize; // Unit test usage constructor. - ThreeLevelCountReadBuffers(DC &ssd, - DC &spd, - DC &pd, - ThreeLevelCountWriteBuffers &wb); + ThreeLevelCountReadBuffers(DC &ssd, DC &spd, DC &pd, ThreeLevelCountWriteBuffers &wb); // Normal usage constructor - ThreeLevelCountReadBuffers(DC &ssd, - DC &spd, - DC &pd); + ThreeLevelCountReadBuffers(DC &ssd, DC &spd, DC &pd); + ~ThreeLevelCountReadBuffers(); }; - -} // namespace diskindex - -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h index f883baf511a..0b9874edb48 100644 --- a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h +++ b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h @@ -3,14 +3,14 @@ #include "searchiteratorverifier.h" #include "document_weight_attribute_helper.h" -namespace search { -namespace test { +namespace search::test { class WeightedChildrenVerifier : public SearchIteratorVerifier { public: WeightedChildrenVerifier() : _weights(_num_children, 1) { } + ~WeightedChildrenVerifier() {} protected: static constexpr size_t _num_children = 7; @@ -57,6 +57,7 @@ public: _helper.set_doc(full_list[i], i % _num_children, 1); } } + ~DwaIteratorChildrenVerifier() {} SearchIterator::UP create(bool strict) const override { (void) strict; std::vector<DocumentWeightIterator> children; @@ -75,4 +76,3 @@ protected: }; } -} diff --git a/searchlib/src/vespa/searchlib/transactionlog/session.h b/searchlib/src/vespa/searchlib/transactionlog/session.h index 622caf4242f..46723bed04c 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/session.h +++ b/searchlib/src/vespa/searchlib/transactionlog/session.h @@ -47,25 +47,25 @@ private: public: VisitTask(const Session::SP & session) : _session(session) { } private: - virtual void run(); + void run() override; Session::SP _session; }; class SubscribeTask : public Task { public: SubscribeTask(const Session::SP & session) : _session(session) { } private: - virtual void run(); + void run() override; Session::SP _session; }; class SendTask : public Task { public: SendTask(const Session::SP & session) : _session(session) { } - virtual void run(); + void run() override; private: Session::SP _session; }; bool send(FRT_RPCRequest * req, bool wait); - virtual void RequestDone(FRT_RPCRequest *req); + void RequestDone(FRT_RPCRequest *req) override; bool send(const Packet & packet); void sendPacket(SerialNum serial, const Packet & packet); bool sendDone(); diff --git a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h index 5478fee61ed..4ee29b91bda 100644 --- a/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h +++ b/searchlib/src/vespa/searchlib/transactionlog/translogserverapp.h @@ -1,33 +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/searchlib/transactionlog/translogserver.h> +#include "translogserver.h" #include <vespa/searchlib/config/config-translogserver.h> #include <vespa/config/helper/configfetcher.h> #include <vespa/vespalib/util/ptrholder.h> -namespace search -{ - -namespace common -{ +namespace search { -class FileHeaderContext; +namespace common { class FileHeaderContext; } -} - -namespace transactionlog -{ +namespace transactionlog { class TransLogServerApp : public config::IFetcherCallback<searchlib::TranslogserverConfig> { private: TransLogServer::SP _tls; - vespalib::PtrHolder<searchlib::TranslogserverConfig> _tlsConfig; + vespalib::PtrHolder<searchlib::TranslogserverConfig> _tlsConfig; config::ConfigFetcher _tlsConfigFetcher; const common::FileHeaderContext & _fileHeaderContext; - void configure(std::unique_ptr<searchlib::TranslogserverConfig> cfg); + void configure(std::unique_ptr<searchlib::TranslogserverConfig> cfg) override ; public: typedef std::unique_ptr<TransLogServerApp> UP; @@ -43,4 +36,3 @@ public: } // namespace transactionlog } // namespace search - diff --git a/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp b/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp index b084e1a59fe..0e254e34915 100644 --- a/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp +++ b/searchlib/src/vespa/searchlib/uca/ucaconverter.cpp @@ -1,13 +1,8 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/searchlib/common/sortspec.h> -#include <vespa/searchlib/uca/ucaconverter.h> + +#include "ucaconverter.h" #include <vespa/vespalib/util/stringfmt.h> #include <vespa/vespalib/util/sync.h> -#include <unicode/coll.h> -#include <unicode/ustring.h> -#include <stdexcept> -#include <vespa/fastlib/text/normwordfolder.h> #include <vespa/vespalib/text/utf8.h> #include <vespa/log/log.h> LOG_SETUP(".search.common.sortspec"); @@ -61,6 +56,8 @@ UcaConverter::UcaConverter(vespalib::stringref locale, vespalib::stringref stren } } +UcaConverter::~UcaConverter() {} + int UcaConverter::utf8ToUtf16(const ConstBufferRef & src) const { UErrorCode status = U_ZERO_ERROR; diff --git a/searchlib/src/vespa/searchlib/uca/ucaconverter.h b/searchlib/src/vespa/searchlib/uca/ucaconverter.h index c71cabda87c..dd405fe6406 100644 --- a/searchlib/src/vespa/searchlib/uca/ucaconverter.h +++ b/searchlib/src/vespa/searchlib/uca/ucaconverter.h @@ -2,10 +2,12 @@ #pragma once +#include <vespa/searchlib/common/converters.h> #include <vespa/searchcommon/common/iblobconverter.h> +#include <vespa/vespalib/stllike/string.h> #include <unicode/coll.h> #include <vector> -#include <vespa/vespalib/stllike/string.h> +#include <cassert> namespace search { @@ -24,6 +26,7 @@ class UcaConverter : public BlobConverter public: using Collator = icu::Collator; UcaConverter(vespalib::stringref locale, vespalib::stringref strength); + ~UcaConverter(); const Collator & getCollator() const { return *_collator; } private: struct Buffer { @@ -52,7 +55,7 @@ private: } }; int utf8ToUtf16(const ConstBufferRef & src) const; - virtual ConstBufferRef onConvert(const ConstBufferRef & src) const; + ConstBufferRef onConvert(const ConstBufferRef & src) const override; mutable Buffer _buffer; mutable std::vector<UChar> _u16Buffer; std::unique_ptr<Collator> _collator; diff --git a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h index 4485caeb24d..2b0eac5062d 100644 --- a/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h +++ b/searchlib/src/vespa/searchlib/uca/ucafunctionnode.h @@ -21,8 +21,8 @@ public: UcaFunctionNode(const UcaFunctionNode & rhs); UcaFunctionNode & operator = (const UcaFunctionNode & rhs); private: - virtual bool onExecute() const; - virtual void onPrepareResult(); + bool onExecute() const override; + void onPrepareResult() override; class Handler { public: Handler(const UcaFunctionNode & uca); @@ -38,14 +38,14 @@ private: class SingleValueHandler : public Handler { public: SingleValueHandler(UcaFunctionNode & uca) : Handler(uca), _result(static_cast<RawResultNode &>(uca.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: RawResultNode & _result; }; class MultiValueHandler : public Handler { public: MultiValueHandler(UcaFunctionNode & uca) : Handler(uca), _result(static_cast<RawResultNodeVector &>(uca.updateResult())) { } - virtual void handle(const ResultNode & arg); + void handle(const ResultNode & arg) override; private: RawResultNodeVector & _result; }; diff --git a/searchlib/src/vespa/searchlib/util/runnable.h b/searchlib/src/vespa/searchlib/util/runnable.h index 16dfdc06bd2..2a69188b6f2 100644 --- a/searchlib/src/vespa/searchlib/util/runnable.h +++ b/searchlib/src/vespa/searchlib/util/runnable.h @@ -17,7 +17,7 @@ public: Runnable() : _cond(), _done(false), _stopped(false) { } - void Run(FastOS_ThreadInterface *, void *) { + void Run(FastOS_ThreadInterface *, void *) override{ doRun(); vespalib::MonitorGuard guard(_cond); |