diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-24 09:22:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-24 09:22:30 +0100 |
commit | 25f4cc0f8e81b33d3ee5888a75447a7f886ac964 (patch) | |
tree | 4ba504d4647b8ff5efc8bd055656dd708d1f695b | |
parent | 457abfc77b712294759dca4b9cfef4ad88213353 (diff) | |
parent | a9b274069da27015e499b1ca16a52a76c36c130b (diff) |
Merge pull request #8204 from vespa-engine/balder/namespace-cleanup
nested namepace and related cleanup.
72 files changed, 310 insertions, 532 deletions
diff --git a/searchlib/src/vespa/searchlib/features/agefeature.h b/searchlib/src/vespa/searchlib/features/agefeature.h index 99898af910f..2914d2df472 100644 --- a/searchlib/src/vespa/searchlib/features/agefeature.h +++ b/searchlib/src/vespa/searchlib/features/agefeature.h @@ -2,11 +2,9 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchcommon/attribute/attributecontent.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the documentage feature outputting the @@ -42,5 +40,3 @@ public: }; } -} - diff --git a/searchlib/src/vespa/searchlib/features/attributefeature.h b/searchlib/src/vespa/searchlib/features/attributefeature.h index 2d206fb738e..c115c4acaea 100644 --- a/searchlib/src/vespa/searchlib/features/attributefeature.h +++ b/searchlib/src/vespa/searchlib/features/attributefeature.h @@ -3,11 +3,9 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/eval/eval/value_type.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the blueprint for the attribute executor. @@ -32,6 +30,4 @@ public: bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/attributematchfeature.h b/searchlib/src/vespa/searchlib/features/attributematchfeature.h index 3cdc6e322a3..487a35ab573 100644 --- a/searchlib/src/vespa/searchlib/features/attributematchfeature.h +++ b/searchlib/src/vespa/searchlib/features/attributematchfeature.h @@ -2,13 +2,10 @@ #pragma once -#include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> #include "queryterm.h" +#include <vespa/searchlib/fef/blueprint.h> -namespace search { -namespace features { +namespace search::features { struct AttributeMatchParams { AttributeMatchParams() : @@ -74,7 +71,7 @@ private: Computer _cmp; - virtual void handle_bind_match_data(const fef::MatchData &md) override; + void handle_bind_match_data(const fef::MatchData &md) override; public: /** @@ -106,7 +103,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/closenessfeature.h b/searchlib/src/vespa/searchlib/features/closenessfeature.h index 15e9bf574f1..d5e3cb36505 100644 --- a/searchlib/src/vespa/searchlib/features/closenessfeature.h +++ b/searchlib/src/vespa/searchlib/features/closenessfeature.h @@ -4,10 +4,8 @@ #include "logarithmcalculator.h" #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the closeness feature. @@ -44,6 +42,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/constant_feature.h b/searchlib/src/vespa/searchlib/features/constant_feature.h index 8f0e2f1cf8e..b7e4a9fdcab 100644 --- a/searchlib/src/vespa/searchlib/features/constant_feature.h +++ b/searchlib/src/vespa/searchlib/features/constant_feature.h @@ -6,8 +6,7 @@ namespace vespalib { namespace eval { struct ConstantValue; } } -namespace search { -namespace features { +namespace search::features { /** * Implements the blueprint for the constant feature. @@ -15,7 +14,7 @@ namespace features { * An executor of this outputs the value of a named constant. * This can either be a number or a tensor value. */ -class ConstantBlueprint : public search::fef::Blueprint { +class ConstantBlueprint : public fef::Blueprint { private: vespalib::string _key; // 'foo' std::unique_ptr<vespalib::eval::ConstantValue> _value; @@ -26,23 +25,19 @@ public: */ ConstantBlueprint(); - ~ConstantBlueprint(); + ~ConstantBlueprint() override; - virtual void visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const override; + void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override; - virtual search::fef::Blueprint::UP createInstance() const override; + fef::Blueprint::UP createInstance() const override; - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions().desc().string(); + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions().desc().string(); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; + bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; + fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h b/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h index 43ce48282ee..2ab7b98fabe 100644 --- a/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h +++ b/searchlib/src/vespa/searchlib/features/constant_tensor_executor.h @@ -9,8 +9,7 @@ #include <vespa/eval/tensor/default_tensor_engine.h> #include <memory> -namespace search { -namespace features { +namespace search::features { /** * Feature executor that returns a constant tensor. @@ -24,8 +23,8 @@ public: ConstantTensorExecutor(vespalib::eval::Value::UP tensor) : _tensor(std::move(tensor)) {} - virtual bool isPure() override { return true; } - virtual void execute(uint32_t) override { + bool isPure() override { return true; } + void execute(uint32_t) override { outputs().set_object(0, *_tensor); } static fef::FeatureExecutor &create(std::unique_ptr<vespalib::eval::Tensor> tensor, vespalib::Stash &stash) { @@ -41,5 +40,4 @@ public: } }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h index fdb23a3f374..94083448ce9 100644 --- a/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h +++ b/searchlib/src/vespa/searchlib/features/debug_attribute_wait.h @@ -2,13 +2,10 @@ #pragma once -#include <string> -#include <vector> +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchcommon/attribute/attributecontent.h> -#include <vespa/searchlib/fef/fef.h> -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- @@ -33,8 +30,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/debug_wait.h b/searchlib/src/vespa/searchlib/features/debug_wait.h index 881cf6cf289..f185b5fae1b 100644 --- a/searchlib/src/vespa/searchlib/features/debug_wait.h +++ b/searchlib/src/vespa/searchlib/features/debug_wait.h @@ -2,12 +2,9 @@ #pragma once -#include <string> -#include <vector> -#include <vespa/searchlib/fef/fef.h> +#include <vespa/searchlib/fef/blueprint.h> -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- @@ -35,8 +32,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.h b/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.h index 3b66d3d0ba1..2bcf356689e 100644 --- a/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/dense_tensor_attribute_executor.h @@ -6,9 +6,8 @@ #include <vespa/eval/eval/value.h> #include <vespa/eval/tensor/dense/mutable_dense_tensor_view.h> -namespace search { -namespace tensor { class ITensorAttribute; } -namespace features { +namespace search::tensor { class ITensorAttribute; } +namespace search::features { /** * Executor for extracting dense tensors from an underlying dense tensor attribute @@ -25,5 +24,4 @@ public: void execute(uint32_t docId) override; }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/distancefeature.h b/searchlib/src/vespa/searchlib/features/distancefeature.h index eaa3c3e50f6..3c75d53ad77 100644 --- a/searchlib/src/vespa/searchlib/features/distancefeature.h +++ b/searchlib/src/vespa/searchlib/features/distancefeature.h @@ -2,13 +2,10 @@ #pragma once -#include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> +#include <vespa/searchcommon/attribute/attributecontent.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the distance feature. @@ -54,7 +51,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h index 442f1ba3b28..e36ace0c601 100644 --- a/searchlib/src/vespa/searchlib/features/distancetopathfeature.h +++ b/searchlib/src/vespa/searchlib/features/distancetopathfeature.h @@ -1,10 +1,8 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> +#include <vespa/searchcommon/attribute/attributecontent.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/documenttestutils.cpp b/searchlib/src/vespa/searchlib/features/documenttestutils.cpp index 896e0922a48..e13699576cd 100644 --- a/searchlib/src/vespa/searchlib/features/documenttestutils.cpp +++ b/searchlib/src/vespa/searchlib/features/documenttestutils.cpp @@ -16,9 +16,7 @@ LOG_SETUP(".features.utils"); using namespace search::fef; -namespace search { -namespace features { -namespace util { +namespace search::features::util { feature_t lookupConnectedness(const search::fef::IQueryEnvironment & env, uint32_t termId, feature_t fallback) { @@ -152,6 +150,4 @@ getTermByLabel(const search::fef::IQueryEnvironment &env, const vespalib::string return 0; } -} // namespace util -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp index 0173455bcf9..ae1271edf5d 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp @@ -64,9 +64,9 @@ DotProductExecutor<Vector, Buffer>::execute(uint32_t docId) outputs().set_number(0, val); } -StringVector::StringVector() { } +StringVector::StringVector() = default; -StringVector::~StringVector() { } +StringVector::~StringVector() = default; } @@ -81,7 +81,7 @@ DotProductExecutorBase<BaseType>::DotProductExecutorBase(const V & queryVector) } template <typename BaseType> -DotProductExecutorBase<BaseType>::~DotProductExecutorBase() { } +DotProductExecutorBase<BaseType>::~DotProductExecutorBase() = default; template <typename BaseType> void DotProductExecutorBase<BaseType>::execute(uint32_t docId) { diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h index c350494db0e..9356fe9c7f2 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h @@ -4,18 +4,14 @@ #include "utils.h" #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/attribute/multivalue.h> #include <vespa/vespalib/hwaccelrated/iaccelrated.h> #include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/vespalib/stllike/hash_map.hpp> -namespace search { -namespace fef { -class Property; -} +namespace search::fef { class Property; } -namespace features { +namespace search::features { namespace dotproduct { @@ -246,7 +242,7 @@ public: SparseDotProductByContentFillExecutor(const attribute::IAttributeVector * attribute, const V & queryVector, const IV & queryIndexes); - ~SparseDotProductByContentFillExecutor(); + ~SparseDotProductByContentFillExecutor() override; private: size_t getAttributeValues(uint32_t docid, const AT * & values) final override; @@ -259,7 +255,6 @@ private: } - /** * Implements the blueprint for the foreach executor. */ @@ -272,7 +267,7 @@ private: public: DotProductBlueprint(); - ~DotProductBlueprint(); + ~DotProductBlueprint() override; void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override; fef::Blueprint::UP createInstance() const override; @@ -281,10 +276,6 @@ public: bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; void prepareSharedState(const fef::IQueryEnvironment & queryEnv, fef::IObjectStore & objectStore) const override; fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; - }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp b/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp index 18988281cbd..1d71fa9d47c 100644 --- a/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_completeness_feature.cpp @@ -1,13 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "element_completeness_feature.h" +#include <vespa/searchlib/fef/itermdata.h> +#include <vespa/searchlib/fef/featurenamebuilder.h> +#include <vespa/searchlib/fef/properties.h> #include <vespa/vespalib/locale/c.h> namespace search::features { //----------------------------------------------------------------------------- -ElementCompletenessExecutor::ElementCompletenessExecutor(const search::fef::IQueryEnvironment &env, +ElementCompletenessExecutor::ElementCompletenessExecutor(const fef::IQueryEnvironment &env, const ElementCompletenessParams ¶ms) : _params(params), _terms(), @@ -16,11 +19,11 @@ ElementCompletenessExecutor::ElementCompletenessExecutor(const search::fef::IQue _md(nullptr) { for (uint32_t i = 0; i < env.getNumTerms(); ++i) { - const search::fef::ITermData *termData = env.getTerm(i); + const fef::ITermData *termData = env.getTerm(i); if (termData->getWeight().percent() != 0) { // only consider query terms with contribution - typedef search::fef::ITermFieldRangeAdapter FRA; + typedef fef::ITermFieldRangeAdapter FRA; for (FRA iter(*termData); iter.valid(); iter.next()) { - const search::fef::ITermFieldData &tfd = iter.get(); + const fef::ITermFieldData &tfd = iter.get(); if (tfd.getFieldId() == _params.fieldId) { int termWeight = termData->getWeight().percent(); _sumTermWeight += termWeight; @@ -36,7 +39,7 @@ ElementCompletenessExecutor::execute(uint32_t docId) { assert(_queue.empty()); for (size_t i = 0; i < _terms.size(); ++i) { - const search::fef::TermFieldMatchData *tfmd = _md->resolveTermField(_terms[i].termHandle); + const fef::TermFieldMatchData *tfmd = _md->resolveTermField(_terms[i].termHandle); if (tfmd->getDocId() == docId) { Item item(i, tfmd->begin(), tfmd->end()); if (item.pos != item.end) { @@ -92,14 +95,14 @@ ElementCompletenessBlueprint::ElementCompletenessBlueprint() } void -ElementCompletenessBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const +ElementCompletenessBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, + fef::IDumpFeatureVisitor &visitor) const { for (uint32_t i = 0; i < env.getNumFields(); ++i) { - const search::fef::FieldInfo &field = *env.getField(i); - if (field.type() == search::fef::FieldType::INDEX) { + const fef::FieldInfo &field = *env.getField(i); + if (field.type() == fef::FieldType::INDEX) { if (!field.isFilter()) { - search::fef::FeatureNameBuilder fnb; + fef::FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field.name()); for (size_t out = 0; out < _output.size(); ++out) { visitor.visitDumpFeature(fnb.output(_output[out]).buildName()); @@ -109,21 +112,21 @@ ElementCompletenessBlueprint::visitDumpFeatures(const search::fef::IIndexEnviron } } -search::fef::Blueprint::UP +fef::Blueprint::UP ElementCompletenessBlueprint::createInstance() const { return Blueprint::UP(new ElementCompletenessBlueprint()); } bool -ElementCompletenessBlueprint::setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) +ElementCompletenessBlueprint::setup(const fef::IIndexEnvironment &env, + const fef::ParameterList ¶ms) { - const search::fef::FieldInfo *field = params[0].asField(); + const fef::FieldInfo *field = params[0].asField(); _params.fieldId = field->id(); - const search::fef::Properties &lst = env.getProperties(); - search::fef::Property obj = lst.lookup(getName(), "fieldCompletenessImportance"); + const fef::Properties &lst = env.getProperties(); + fef::Property obj = lst.lookup(getName(), "fieldCompletenessImportance"); if (obj.found()) { _params.fieldCompletenessImportance = vespalib::locale::c::atof(obj.get().c_str()); } @@ -135,8 +138,8 @@ ElementCompletenessBlueprint::setup(const search::fef::IIndexEnvironment &env, return true; } -search::fef::FeatureExecutor & -ElementCompletenessBlueprint::createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const +fef::FeatureExecutor & +ElementCompletenessBlueprint::createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const { return stash.create<ElementCompletenessExecutor>(env, _params); } diff --git a/searchlib/src/vespa/searchlib/features/element_completeness_feature.h b/searchlib/src/vespa/searchlib/features/element_completeness_feature.h index 1b835da45d2..ea971b6b036 100644 --- a/searchlib/src/vespa/searchlib/features/element_completeness_feature.h +++ b/searchlib/src/vespa/searchlib/features/element_completeness_feature.h @@ -2,11 +2,10 @@ #pragma once -#include <vespa/searchlib/fef/fef.h> +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/vespalib/util/priority_queue.h> -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- @@ -117,8 +116,4 @@ public: const ElementCompletenessParams &getParams() const { return _params; } }; -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp index c9eab238f82..45d9ddb3763 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp @@ -1,18 +1,19 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "element_similarity_feature.h" +#include <vespa/searchlib/fef/itermdata.h> +#include <vespa/searchlib/fef/featurenamebuilder.h> +#include <vespa/searchlib/fef/properties.h> #include <vespa/eval/eval/llvm/compiled_function.h> #include <vespa/eval/eval/llvm/compile_cache.h> #include <vespa/log/log.h> LOG_SETUP(".features.elementsimilarity"); -namespace search { +namespace search::features { using CollectionType = fef::FieldInfo::CollectionType; -namespace features { - namespace { //----------------------------------------------------------------------------- @@ -29,6 +30,7 @@ struct Aggregator { struct MaxAggregator : Aggregator { size_t count; double value; + MaxAggregator() : count(0), value(0.0) {} UP create() const override { return UP(new MaxAggregator()); } void clear() override { count = 0; value = 0.0; } @@ -39,15 +41,18 @@ struct MaxAggregator : Aggregator { struct AvgAggregator : Aggregator { size_t count; double value; + AvgAggregator() : count(0), value(0.0) {} + UP create() const override { return UP(new AvgAggregator()); } void clear() override { count = 0; value = 0.0; } - void add(double v) override { ++count; value += v; } - double get() const override { return (count == 0) ? 0.0 : (value/count); } + void add(double v) override { ++count;value += v; } + double get() const override { return (count == 0) ? 0.0 : (value / count); } }; struct SumAggregator : Aggregator { double value; + SumAggregator() : value(0.0) {} UP create() const override { return UP(new SumAggregator()); } void clear() override { value = 0.0; } @@ -55,7 +60,8 @@ struct SumAggregator : Aggregator { double get() const override { return value; } }; -Aggregator::UP create_aggregator(const vespalib::string &name) { +Aggregator::UP +create_aggregator(const vespalib::string &name) { if (name == "max") { return Aggregator::UP(new MaxAggregator()); } @@ -71,6 +77,7 @@ Aggregator::UP create_aggregator(const vespalib::string &name) { //----------------------------------------------------------------------------- typedef double (*function_5)(double, double, double, double, double); + typedef std::pair<function_5, Aggregator::UP> OutputSpec; //----------------------------------------------------------------------------- @@ -78,19 +85,25 @@ typedef std::pair<function_5, Aggregator::UP> OutputSpec; struct VectorizedQueryTerms { struct Term { fef::TermFieldHandle handle; - int weight; - int index; + int weight; + int index; + Term(fef::TermFieldHandle handle_in, int weight_in, int index_in) - : handle(handle_in), weight(weight_in), index(index_in) {} + : handle(handle_in), weight(weight_in), index(index_in) + {} }; std::vector<fef::TermFieldHandle> handles; - std::vector<int> weights; - int total_weight; + std::vector<int> weights; + int total_weight; VectorizedQueryTerms(const VectorizedQueryTerms &) = delete; + VectorizedQueryTerms(VectorizedQueryTerms &&rhs) - : handles(std::move(rhs.handles)), weights(std::move(rhs.weights)), total_weight(rhs.total_weight) {} + : handles(std::move(rhs.handles)), weights(std::move(rhs.weights)), + total_weight(rhs.total_weight) + {} + VectorizedQueryTerms(const fef::IQueryEnvironment &env, uint32_t field_id) : handles(), weights(), total_weight(0) { @@ -104,13 +117,12 @@ struct VectorizedQueryTerms { if (tfd.getFieldId() == field_id) { int term_weight = termData->getWeight().percent(); total_weight += term_weight; - terms.push_back(Term(tfd.getHandle(), term_weight, - termData->getTermIndex())); + terms.push_back(Term(tfd.getHandle(), term_weight, termData->getTermIndex())); } } } } - std::sort(terms.begin(), terms.end(), [](const Term &a, const Term &b){ return (a.index < b.index); }); + std::sort(terms.begin(), terms.end(), [](const Term &a, const Term &b) { return (a.index < b.index); }); handles.reserve(terms.size()); weights.reserve(terms.size()); for (size_t i = 0; i < terms.size(); ++i) { @@ -118,21 +130,22 @@ struct VectorizedQueryTerms { weights.push_back(terms[i].weight); } } + ~VectorizedQueryTerms(); }; -VectorizedQueryTerms::~VectorizedQueryTerms() { } +VectorizedQueryTerms::~VectorizedQueryTerms() = default; //----------------------------------------------------------------------------- struct State { - uint32_t element_length; - uint32_t matched_terms; - int sum_term_weight; - uint32_t last_pos; - double sum_proximity_score; - uint32_t last_idx; - uint32_t num_in_order; + uint32_t element_length; + uint32_t matched_terms; + int sum_term_weight; + uint32_t last_pos; + double sum_proximity_score; + uint32_t last_idx; + uint32_t num_in_order; double proximity; double order; @@ -148,10 +161,11 @@ struct State { last_idx(first_idx), num_in_order(0), proximity(0.0), order(0.0), query_coverage(0.0), field_coverage(0.0), - element_weight(element_weight_in) {} + element_weight(element_weight_in) + {} double proximity_score(uint32_t dist) { - return (dist > 8) ? 0 : (1.0 - (((dist-1)/8.0) * ((dist-1)/8.0))); + return (dist > 8) ? 0 : (1.0 - (((dist - 1) / 8.0) * ((dist - 1) / 8.0))); } bool want_match(uint32_t pos) { @@ -162,7 +176,7 @@ struct State { sum_proximity_score += proximity_score(pos - last_pos); num_in_order += (idx > last_idx) ? 1 : 0; last_pos = pos; - last_idx = idx; + last_idx = idx; ++matched_terms; sum_term_weight += weight; } @@ -190,24 +204,28 @@ private: struct CmpPosition { ITR *pos; + CmpPosition(ITR *pos_in) : pos(pos_in) {} + bool operator()(uint16_t a, uint16_t b) { return (pos[a]->getPosition() == pos[b]->getPosition()) - ? (a < b) - : (pos[a]->getPosition() < pos[b]->getPosition()); + ? (a < b) + : (pos[a]->getPosition() < pos[b]->getPosition()); } }; struct CmpElement { ITR *pos; + CmpElement(ITR *pos_in) : pos(pos_in) {} + bool operator()(uint16_t a, uint16_t b) { return pos[a]->getElementId() < pos[b]->getElementId(); } }; typedef vespalib::PriorityQueue<uint16_t, CmpPosition> PositionQueue; - typedef vespalib::PriorityQueue<uint16_t, CmpElement> ElementQueue; + typedef vespalib::PriorityQueue<uint16_t, CmpElement> ElementQueue; VectorizedQueryTerms _terms; std::vector<ITR> _pos; @@ -215,7 +233,7 @@ private: PositionQueue _position_queue; ElementQueue _element_queue; std::vector<OutputSpec> _outputs; - const fef::MatchData *_md; + const fef::MatchData *_md; public: ElementSimilarityExecutor(VectorizedQueryTerms &&terms, std::vector<OutputSpec> &&outputs_in) @@ -226,7 +244,7 @@ public: _element_queue(CmpElement(&_pos[0])), _outputs(std::move(outputs_in)), _md(nullptr) - {} + { } bool isPure() override { return _terms.handles.empty(); } @@ -235,9 +253,7 @@ public: } void requeue_term(uint16_t term, uint32_t element) { - while (_pos[term] != _end[term] && - _pos[term]->getElementId() == element) - { + while (_pos[term] != _end[term] && (_pos[term]->getElementId() == element)) { ++_pos[term]; } if (_pos[term] != _end[term]) { @@ -276,10 +292,8 @@ public: while (!_position_queue.empty()) { uint16_t item = _position_queue.front(); if (state.want_match(_pos[item]->getPosition())) { - state.addMatch(_pos[item]->getPosition(), - _terms.weights[item], - item); - requeue_term(_position_queue.front(), elementId); + state.addMatch(_pos[item]->getPosition(), _terms.weights[item], item); + requeue_term(_position_queue.front(), elementId); _position_queue.pop_front(); } else { ++_pos[item]; @@ -293,8 +307,8 @@ public: state.calculate_scores(_terms.handles.size(), _terms.total_weight); for (auto &output: _outputs) { output.second->add(output.first(state.proximity, state.order, - state.query_coverage, state.field_coverage, - state.element_weight)); + state.query_coverage, state.field_coverage, + state.element_weight)); } } for (size_t i = 0; i < _outputs.size(); ++i) { @@ -305,18 +319,20 @@ public: //----------------------------------------------------------------------------- -std::vector<std::pair<vespalib::string, vespalib::string> > extract_properties(const fef::Properties &props, - const vespalib::string &ns, const vespalib::string &first_name, const vespalib::string &first_default) +std::vector<std::pair<vespalib::string, vespalib::string> > +extract_properties(const fef::Properties &props, const vespalib::string &ns, + const vespalib::string &first_name, const vespalib::string &first_default) { struct MyVisitor : fef::IPropertiesVisitor { const vespalib::string &first_name; std::vector<std::pair<vespalib::string, vespalib::string> > &result; + MyVisitor(const vespalib::string &first_name_in, std::vector<std::pair<vespalib::string, vespalib::string> > &result_in) - : first_name(first_name_in), result(result_in) {} - virtual void visitProperty(const fef::Property::Value &key, - const fef::Property &values) override - { + : first_name(first_name_in), result(result_in) + {} + + void visitProperty(const fef::Property::Value &key, const fef::Property &values) override { if (key != first_name) { result.emplace_back(key, values.get()); } @@ -329,9 +345,8 @@ std::vector<std::pair<vespalib::string, vespalib::string> > extract_properties(c return result; } -std::vector<std::pair<vespalib::string, vespalib::string> > get_outputs(const fef::Properties &props, - const vespalib::string &feature) -{ +std::vector<std::pair<vespalib::string, vespalib::string> > +get_outputs(const fef::Properties &props, const vespalib::string &feature) { return extract_properties(props, feature + ".output", "default", "max((0.35*p+0.15*o+0.30*q+0.20*f)*w)"); } @@ -340,20 +355,22 @@ std::vector<std::pair<vespalib::string, vespalib::string> > get_outputs(const fe //----------------------------------------------------------------------------- struct ElementSimilarityBlueprint::OutputContext { - vespalib::eval::CompileCache::Token::UP compile_token; + vespalib::eval::CompileCache::Token::UP compile_token; Aggregator::UP aggregator_factory; - OutputContext(const vespalib::eval::Function &function, - Aggregator::UP aggregator) + + OutputContext(const vespalib::eval::Function &function, Aggregator::UP aggregator) : compile_token(vespalib::eval::CompileCache::compile(function, vespalib::eval::PassParams::SEPARATE)), - aggregator_factory(std::move(aggregator)) {} + aggregator_factory(std::move(aggregator)) + {} }; //----------------------------------------------------------------------------- ElementSimilarityBlueprint::ElementSimilarityBlueprint() - : Blueprint("elementSimilarity"), _field_id(fef::IllegalHandle), _outputs() {} + : Blueprint("elementSimilarity"), _field_id(fef::IllegalHandle), _outputs() +{} -ElementSimilarityBlueprint::~ElementSimilarityBlueprint() {} +ElementSimilarityBlueprint::~ElementSimilarityBlueprint() = default; void ElementSimilarityBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, @@ -363,7 +380,7 @@ ElementSimilarityBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, const fef::FieldInfo &field = *env.getField(i); if ((field.type() == fef::FieldType::INDEX) && (field.collection() != CollectionType::SINGLE) && - ( ! field.isFilter())) + (!field.isFilter())) { fef::FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field.name()); @@ -377,8 +394,7 @@ ElementSimilarityBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, } bool -ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, - const fef::ParameterList ¶ms) +ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) { const fef::FieldInfo *field = params[0].asField(); _field_id = field->id(); @@ -391,7 +407,8 @@ ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, vespalib::string expr; vespalib::string error; if (!vespalib::eval::Function::unwrap(entry.second, aggr_name, expr, error)) { - LOG(warning, "'%s': could not extract aggregator and expression for output '%s' from config value '%s' (%s)", + LOG(warning, + "'%s': could not extract aggregator and expression for output '%s' from config value '%s' (%s)", fnb.buildName().c_str(), entry.first.c_str(), entry.second.c_str(), error.c_str()); return false; } @@ -400,7 +417,7 @@ ElementSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, LOG(warning, "'%s': unknown aggregator '%s'", fnb.buildName().c_str(), aggr_name.c_str()); return false; } - std::vector<vespalib::string> args({"p","o","q","f","w"}); + std::vector<vespalib::string> args({"p", "o", "q", "f", "w"}); vespalib::eval::Function function = vespalib::eval::Function::parse(args, expr); if (function.has_error()) { LOG(warning, "'%s': per-element expression parse error: %s", @@ -424,7 +441,4 @@ ElementSimilarityBlueprint::createExecutor(const fef::IQueryEnvironment &env, ve return stash.create<ElementSimilarityExecutor>(VectorizedQueryTerms(env, _field_id), std::move(output_specs)); } -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.h b/searchlib/src/vespa/searchlib/features/element_similarity_feature.h index 658cb872750..1c07a28b5d9 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.h +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.h @@ -2,11 +2,10 @@ #pragma once -#include <vespa/searchlib/fef/fef.h> +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/vespalib/util/priority_queue.h> -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- @@ -34,8 +33,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h index ba3f0b6da34..7825b286649 100644 --- a/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h +++ b/searchlib/src/vespa/searchlib/features/euclidean_distance_feature.h @@ -3,13 +3,9 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchcommon/attribute/attributecontent.h> - -namespace search { -namespace features { - +namespace search::features { /** * Implements the executor for the eucledian distance feature. @@ -31,7 +27,7 @@ private: public: EuclideanDistanceExecutor(const search::attribute::IAttributeVector &attribute, QueryVectorType vector); - virtual void execute(uint32_t docId) override; + void execute(uint32_t docId) override; }; @@ -57,7 +53,4 @@ public: }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/fieldinfofeature.h b/searchlib/src/vespa/searchlib/features/fieldinfofeature.h index 7ced5d5cb9f..f8d45d83af6 100644 --- a/searchlib/src/vespa/searchlib/features/fieldinfofeature.h +++ b/searchlib/src/vespa/searchlib/features/fieldinfofeature.h @@ -3,11 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> -namespace search { -namespace features { +namespace search::features { class IndexFieldInfoExecutor : public fef::FeatureExecutor { @@ -67,6 +64,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/fieldlengthfeature.h b/searchlib/src/vespa/searchlib/features/fieldlengthfeature.h index 4988bb97546..31b02b7d8fc 100644 --- a/searchlib/src/vespa/searchlib/features/fieldlengthfeature.h +++ b/searchlib/src/vespa/searchlib/features/fieldlengthfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for field length. @@ -15,7 +13,7 @@ private: std::vector<fef::TermFieldHandle> _fieldHandles; const fef::MatchData *_md; - virtual void handle_bind_match_data(const fef::MatchData &md) override; + void handle_bind_match_data(const fef::MatchData &md) override; public: /** @@ -48,5 +46,4 @@ public: bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h index 71ac1023df6..1f21364b294 100644 --- a/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/fieldmatchfeature.h @@ -2,12 +2,11 @@ #pragma once +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/features/fieldmatch/computer.h> #include <vespa/searchlib/features/fieldmatch/params.h> -#include <vespa/searchlib/fef/blueprint.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for THE field match feature. @@ -52,6 +51,5 @@ public: bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override; fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search + +} diff --git a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.h b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.h index 0f89f7eeb75..c69014bb184 100644 --- a/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/fieldtermmatchfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for term feature. @@ -49,5 +47,4 @@ private: uint32_t _termId; }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/firstphasefeature.h b/searchlib/src/vespa/searchlib/features/firstphasefeature.h index baf640d1492..5edd7a7ce0a 100644 --- a/searchlib/src/vespa/searchlib/features/firstphasefeature.h +++ b/searchlib/src/vespa/searchlib/features/firstphasefeature.h @@ -4,8 +4,7 @@ #include <vespa/searchlib/fef/blueprint.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor outputting the first phase ranking. @@ -33,6 +32,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.cpp b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.cpp index c46d602983d..871c53221c8 100644 --- a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.cpp @@ -1,17 +1,20 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "flow_completeness_feature.h" +#include <vespa/searchlib/fef/itermdata.h> +#include <vespa/searchlib/fef/featurenamebuilder.h> +#include <vespa/searchlib/fef/properties.h> +#include <vespa/searchlib/fef/indexproperties.h> #include <vespa/vespalib/stllike/hash_map.h> #include <vespa/vespalib/locale/c.h> #include <vespa/log/log.h> LOG_SETUP(".features.flowcompleteness"); -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- -FlowCompletenessExecutor::FlowCompletenessExecutor(const search::fef::IQueryEnvironment &env, +FlowCompletenessExecutor::FlowCompletenessExecutor(const fef::IQueryEnvironment &env, const FlowCompletenessParams ¶ms) : _params(params), _terms(), @@ -20,13 +23,13 @@ FlowCompletenessExecutor::FlowCompletenessExecutor(const search::fef::IQueryEnvi { for (uint32_t i = 0; i < env.getNumTerms(); ++i) { LOG(spam, "consider term %u", i); - const search::fef::ITermData *termData = env.getTerm(i); + const fef::ITermData *termData = env.getTerm(i); LOG(spam, "term %u weight %u", i, termData->getWeight().percent()); if (termData->getWeight().percent() != 0) { // only consider query terms with contribution - typedef search::fef::ITermFieldRangeAdapter FRA; + typedef fef::ITermFieldRangeAdapter FRA; uint32_t j = 0; for (FRA iter(*termData); iter.valid(); iter.next()) { - const search::fef::ITermFieldData &tfd = iter.get(); + const fef::ITermFieldData &tfd = iter.get(); LOG(spam, "term %u field data %u for field id %u (my field id %u)", i, j++, tfd.getFieldId(), _params.fieldId); if (tfd.getFieldId() == _params.fieldId) { @@ -184,7 +187,7 @@ FlowCompletenessExecutor::execute(uint32_t) { assert(_queue.empty()); for (size_t i = 0; i < _terms.size(); ++i) { - const search::fef::TermFieldMatchData *tfmd = _md->resolveTermField(_terms[i].termHandle); + const fef::TermFieldMatchData *tfmd = _md->resolveTermField(_terms[i].termHandle); Item item(i, tfmd->begin(), tfmd->end()); LOG(spam, "found tfmd item with %zu positions", (item.end - item.pos)); if (item.pos != item.end) { @@ -255,15 +258,15 @@ FlowCompletenessBlueprint::FlowCompletenessBlueprint() } void -FlowCompletenessBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const +FlowCompletenessBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, + fef::IDumpFeatureVisitor &visitor) const { #ifdef notyet for (uint32_t i = 0; i < env.getNumFields(); ++i) { - const search::fef::FieldInfo &field = *env.getField(i); - if (field.type() == search::fef::FieldType::INDEX) { + const fef::FieldInfo &field = *env.getField(i); + if (field.type() == fef::FieldType::INDEX) { if (!field.isFilter()) { - search::fef::FeatureNameBuilder fnb; + fef::FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field.name()); for (size_t out = 0; out < _output.size(); ++out) { visitor.visitDumpFeature(fnb.output(_output[out]).buildName()); @@ -277,25 +280,25 @@ FlowCompletenessBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironmen #endif } -search::fef::Blueprint::UP +fef::Blueprint::UP FlowCompletenessBlueprint::createInstance() const { return Blueprint::UP(new FlowCompletenessBlueprint()); } bool -FlowCompletenessBlueprint::setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) +FlowCompletenessBlueprint::setup(const fef::IIndexEnvironment &env, + const fef::ParameterList ¶ms) { - const search::fef::FieldInfo *field = params[0].asField(); + const fef::FieldInfo *field = params[0].asField(); _params.fieldId = field->id(); - const search::fef::Properties &lst = env.getProperties(); - search::fef::Property obj = lst.lookup(getName(), "fieldCompletenessImportance"); + const fef::Properties &lst = env.getProperties(); + fef::Property obj = lst.lookup(getName(), "fieldCompletenessImportance"); if (obj.found()) { _params.fieldCompletenessImportance = vespalib::locale::c::atof(obj.get().c_str()); } - _params.fieldWeight = search::fef::indexproperties::FieldWeight::lookup(lst, field->name()); + _params.fieldWeight = fef::indexproperties::FieldWeight::lookup(lst, field->name()); describeOutput(_output[0], "combined completeness for best scored element"); describeOutput(_output[1], "best scored element completeness"); @@ -307,13 +310,12 @@ FlowCompletenessBlueprint::setup(const search::fef::IIndexEnvironment &env, return true; } -search::fef::FeatureExecutor & -FlowCompletenessBlueprint::createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const +fef::FeatureExecutor & +FlowCompletenessBlueprint::createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const { return stash.create<FlowCompletenessExecutor>(env, _params); } //----------------------------------------------------------------------------- -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h index db5c53beac8..cb3a71950ae 100644 --- a/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h +++ b/searchlib/src/vespa/searchlib/features/flow_completeness_feature.h @@ -2,7 +2,7 @@ #pragma once -#include <vespa/searchlib/fef/fef.h> +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/vespalib/util/priority_queue.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/foreachfeature.h b/searchlib/src/vespa/searchlib/features/foreachfeature.h index 955724fb9c2..0eba4e36528 100644 --- a/searchlib/src/vespa/searchlib/features/foreachfeature.h +++ b/searchlib/src/vespa/searchlib/features/foreachfeature.h @@ -3,11 +3,9 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <limits> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the foreach feature. @@ -163,7 +161,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/freshnessfeature.h b/searchlib/src/vespa/searchlib/features/freshnessfeature.h index e156cad53ed..1512a3255ad 100644 --- a/searchlib/src/vespa/searchlib/features/freshnessfeature.h +++ b/searchlib/src/vespa/searchlib/features/freshnessfeature.h @@ -4,10 +4,8 @@ #include "logarithmcalculator.h" #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the freshness feature. @@ -42,7 +40,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h index d6a55f29632..5bc7602e259 100644 --- a/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h +++ b/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { class ItemRawScoreExecutor : public fef::FeatureExecutor { @@ -61,6 +59,4 @@ public: static HandleVector resolve(const fef::IQueryEnvironment &env, const vespalib::string &label); }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.h b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.h index a8d6eacf0eb..3c3f00eda8e 100644 --- a/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/jarowinklerdistancefeature.h @@ -2,11 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the necessary config to pass from the jaro winkler distance blueprint to the executor. @@ -68,5 +65,4 @@ private: JaroWinklerDistanceConfig _config; // The config for this blueprint. }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/logarithmcalculator.h b/searchlib/src/vespa/searchlib/features/logarithmcalculator.h index d09f3a8e6ac..b223a6f2207 100644 --- a/searchlib/src/vespa/searchlib/features/logarithmcalculator.h +++ b/searchlib/src/vespa/searchlib/features/logarithmcalculator.h @@ -5,8 +5,7 @@ #include <vespa/searchlib/common/feature.h> #include <cmath> -namespace search { -namespace features { +namespace search::features { /** * This class is used to calculate a logarithmic-shaped function that goes from 1 to 0. @@ -57,6 +56,4 @@ public: } }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/matchcountfeature.h b/searchlib/src/vespa/searchlib/features/matchcountfeature.h index eadb5064c57..a81f4f084b8 100644 --- a/searchlib/src/vespa/searchlib/features/matchcountfeature.h +++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the matchCount feature for index and @@ -18,7 +16,7 @@ private: std::vector<fef::TermFieldHandle> _handles; const fef::MatchData *_md; - virtual void handle_bind_match_data(const fef::MatchData &md) override; + void handle_bind_match_data(const fef::MatchData &md) override; public: MatchCountExecutor(uint32_t fieldId, const fef::IQueryEnvironment &env); @@ -54,6 +52,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/matchesfeature.h b/searchlib/src/vespa/searchlib/features/matchesfeature.h index c6366349dd9..53c6151a713 100644 --- a/searchlib/src/vespa/searchlib/features/matchesfeature.h +++ b/searchlib/src/vespa/searchlib/features/matchesfeature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the matches feature for index and @@ -52,6 +50,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/matchfeature.h b/searchlib/src/vespa/searchlib/features/matchfeature.h index 64d931a08d8..de3205aa7a1 100644 --- a/searchlib/src/vespa/searchlib/features/matchfeature.h +++ b/searchlib/src/vespa/searchlib/features/matchfeature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { struct MatchParams { MatchParams() : weights() {} @@ -45,7 +43,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/native_dot_product_feature.h b/searchlib/src/vespa/searchlib/features/native_dot_product_feature.h index 33c5c89c88b..0d7c75c7cf7 100644 --- a/searchlib/src/vespa/searchlib/features/native_dot_product_feature.h +++ b/searchlib/src/vespa/searchlib/features/native_dot_product_feature.h @@ -3,12 +3,10 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/query/weight.h> #include <algorithm> -namespace search { -namespace features { +namespace search::features { class NativeDotProductExecutor : public fef::FeatureExecutor { @@ -44,6 +42,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.h b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.h index e2c9dc7aef1..0f897c76fc4 100644 --- a/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativeattributematchfeature.h @@ -7,8 +7,7 @@ #include <vespa/searchlib/fef/itermfielddata.h> #include <vespa/searchlib/fef/symmetrictable.h> -namespace search { -namespace features { +namespace search::features { /** * This struct contains parameters used by the executor. @@ -101,6 +100,4 @@ public: const NativeAttributeMatchParams & getParams() const { return _params; } }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h index cb676e5b775..539b64ced16 100644 --- a/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativefieldmatchfeature.h @@ -6,8 +6,7 @@ #include "queryterm.h" #include <vespa/fastos/dynamiclibrary.h> -namespace search { -namespace features { +namespace search::features { /** * This struct contains parameters used by the executor. @@ -114,7 +113,4 @@ public: const NativeFieldMatchParams & getParams() const { return _params; } }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h index f98fe2bfd22..13f2ea2dbcd 100644 --- a/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativeproximityfeature.h @@ -6,8 +6,7 @@ #include "queryterm.h" #include "termdistancecalculator.h" -namespace search { -namespace features { +namespace search::features { /** * This struct contains parameters used by the executor. @@ -98,7 +97,4 @@ public: const NativeProximityParams & getParams() const { return _params; } }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/nativerankfeature.h b/searchlib/src/vespa/searchlib/features/nativerankfeature.h index db43b7cf4f5..3b8ddccaa1d 100644 --- a/searchlib/src/vespa/searchlib/features/nativerankfeature.h +++ b/searchlib/src/vespa/searchlib/features/nativerankfeature.h @@ -3,12 +3,10 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/fieldtype.h> #include <vespa/searchlib/fef/table.h> -namespace search { -namespace features { +namespace search::features { /** * This struct contains parameters used by the nativeRank executor. @@ -116,6 +114,4 @@ public: static bool useTableNormalization(const fef::IIndexEnvironment & env); }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/nowfeature.h b/searchlib/src/vespa/searchlib/features/nowfeature.h index 867a8c15855..e9191689fb2 100644 --- a/searchlib/src/vespa/searchlib/features/nowfeature.h +++ b/searchlib/src/vespa/searchlib/features/nowfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for the 'now' feature. This executor returns the current @@ -43,5 +41,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/proximityfeature.h b/searchlib/src/vespa/searchlib/features/proximityfeature.h index 14a80628004..5cb8adaa287 100644 --- a/searchlib/src/vespa/searchlib/features/proximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/proximityfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the necessary config for proximity. @@ -62,4 +60,4 @@ private: ProximityConfig _config; }; -}} +} diff --git a/searchlib/src/vespa/searchlib/features/querycompletenessfeature.h b/searchlib/src/vespa/searchlib/features/querycompletenessfeature.h index a5e6bbdc2bb..3c0efdecf58 100644 --- a/searchlib/src/vespa/searchlib/features/querycompletenessfeature.h +++ b/searchlib/src/vespa/searchlib/features/querycompletenessfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the necessary config for query completeness. @@ -63,5 +61,4 @@ private: QueryCompletenessConfig _config; }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/queryfeature.h b/searchlib/src/vespa/searchlib/features/queryfeature.h index 779153437d4..0d4424db792 100644 --- a/searchlib/src/vespa/searchlib/features/queryfeature.h +++ b/searchlib/src/vespa/searchlib/features/queryfeature.h @@ -5,8 +5,7 @@ #include <vespa/searchlib/fef/blueprint.h> #include <vespa/eval/eval/value_type.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the blueprint for the query feature. @@ -34,6 +33,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/queryterm.cpp b/searchlib/src/vespa/searchlib/features/queryterm.cpp index 8b43df28178..84423493eb5 100644 --- a/searchlib/src/vespa/searchlib/features/queryterm.cpp +++ b/searchlib/src/vespa/searchlib/features/queryterm.cpp @@ -6,8 +6,7 @@ using namespace search::fef; using search::feature_t; -namespace search { -namespace features { +namespace search::features { QueryTerm::QueryTerm() : _termData(NULL), @@ -45,5 +44,4 @@ QueryTermFactory::create(const IQueryEnvironment & env, } -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/querytermcountfeature.h b/searchlib/src/vespa/searchlib/features/querytermcountfeature.h index 39b85756c07..f31fb1daf18 100644 --- a/searchlib/src/vespa/searchlib/features/querytermcountfeature.h +++ b/searchlib/src/vespa/searchlib/features/querytermcountfeature.h @@ -3,11 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the blueprint for the query term count feature. @@ -26,7 +23,4 @@ public: search::fef::FeatureExecutor &createExecutor(const search::fef::IQueryEnvironment & env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/random_normal_feature.h b/searchlib/src/vespa/searchlib/features/random_normal_feature.h index adf3d3be63f..bf0aa66ea36 100644 --- a/searchlib/src/vespa/searchlib/features/random_normal_feature.h +++ b/searchlib/src/vespa/searchlib/features/random_normal_feature.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/util/random_normal.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h index ab9a53a2df3..6211999a4f6 100644 --- a/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h +++ b/searchlib/src/vespa/searchlib/features/random_normal_stable_feature.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/util/random_normal.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/randomfeature.h b/searchlib/src/vespa/searchlib/features/randomfeature.h index 8ed0e403836..8c94b71071f 100644 --- a/searchlib/src/vespa/searchlib/features/randomfeature.h +++ b/searchlib/src/vespa/searchlib/features/randomfeature.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/util/rand48.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.h b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.h index 85514a4def7..8d5144206ea 100644 --- a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.h +++ b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.h @@ -2,7 +2,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/eval/eval/interpreted_function.h> #include <vespa/eval/eval/llvm/compile_cache.h> #include <vespa/searchlib/features/rankingexpression/expression_replacer.h> diff --git a/searchlib/src/vespa/searchlib/features/raw_score_feature.h b/searchlib/src/vespa/searchlib/features/raw_score_feature.h index db237f036c4..2a4eb946a68 100644 --- a/searchlib/src/vespa/searchlib/features/raw_score_feature.h +++ b/searchlib/src/vespa/searchlib/features/raw_score_feature.h @@ -3,7 +3,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h index 776dde39f77..d06b6c57fe7 100644 --- a/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h +++ b/searchlib/src/vespa/searchlib/features/reverseproximityfeature.h @@ -2,10 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the necessary config for reverse proximity. @@ -59,5 +57,4 @@ private: ReverseProximityConfig _config; }; -}} - +} diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp index 1d3c59f5b3d..a4a9689b971 100644 --- a/searchlib/src/vespa/searchlib/features/setup.cpp +++ b/searchlib/src/vespa/searchlib/features/setup.cpp @@ -54,15 +54,14 @@ #include "valuefeature.h" #include "constant_feature.h" -#include <vespa/searchlib/features/max_reduce_prod_join_replacer.h> +#include "max_reduce_prod_join_replacer.h" #include <vespa/searchlib/features/rankingexpression/expression_replacer.h> using search::fef::Blueprint; using search::features::rankingexpression::ListExpressionReplacer; using search::features::MaxReduceProdJoinReplacer; -namespace search { -namespace features { +namespace search::features { void setup_search_features(fef::IBlueprintRegistry & registry) { @@ -127,5 +126,4 @@ void setup_search_features(fef::IBlueprintRegistry & registry) registry.addPrototype(std::make_shared<RankingExpressionBlueprint>(std::move(replacers))); } -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/setup.h b/searchlib/src/vespa/searchlib/features/setup.h index 3c3057250bf..3904882c3a8 100644 --- a/searchlib/src/vespa/searchlib/features/setup.h +++ b/searchlib/src/vespa/searchlib/features/setup.h @@ -4,8 +4,7 @@ #include <vespa/searchlib/fef/blueprint.h> #include <vespa/searchlib/fef/iblueprintregistry.h> -namespace search { -namespace features { +namespace search::features { /** * Adds prototypes for all features in this library to the given registry. @@ -14,6 +13,4 @@ namespace features { **/ void setup_search_features(fef::IBlueprintRegistry & registry); -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/subqueries_feature.h b/searchlib/src/vespa/searchlib/features/subqueries_feature.h index 136d8d90f94..3a6be567548 100644 --- a/searchlib/src/vespa/searchlib/features/subqueries_feature.h +++ b/searchlib/src/vespa/searchlib/features/subqueries_feature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { class SubqueriesExecutor : public fef::FeatureExecutor { std::vector<fef::TermFieldHandle> _handles; @@ -37,6 +35,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h index 3f981e06482..2b2e1e6e4f1 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_attribute_executor.h @@ -8,9 +8,8 @@ #include <vespa/vespalib/stllike/string.h> #include <vespa/eval/tensor/default_tensor.h> -namespace search { -namespace tensor { class ITensorAttribute; } -namespace features { +namespace search::tensor { class ITensorAttribute; } +namespace search::features { class TensorAttributeExecutor : public fef::FeatureExecutor { @@ -24,5 +23,4 @@ public: void execute(uint32_t docId) override; }; -} // 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 eb75b851bb9..c2b6534ae74 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h +++ b/searchlib/src/vespa/searchlib/features/tensor_factory_blueprint.h @@ -5,13 +5,12 @@ #include <vespa/searchlib/fef/blueprint.h> #include <vespa/vespalib/stllike/string.h> -namespace search { -namespace features { +namespace search::features { /** * Factory class for tensor rank features. */ -class TensorFactoryBlueprint : public search::fef::Blueprint +class TensorFactoryBlueprint : public fef::Blueprint { protected: static vespalib::string ATTRIBUTE_SOURCE; @@ -26,9 +25,8 @@ protected: ~TensorFactoryBlueprint(); public: - void visitDumpFeatures(const search::fef::IIndexEnvironment &, - search::fef::IDumpFeatureVisitor &) const override {} + void visitDumpFeatures(const fef::IIndexEnvironment &, + fef::IDumpFeatureVisitor &) const override {} }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h index f102749f1b6..4c5f64611c1 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_attribute_executor.h @@ -3,13 +3,11 @@ #pragma once #include <vespa/searchcommon/attribute/iattributevector.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/eval/eval/value.h> #include <vespa/vespalib/stllike/string.h> #include <vespa/eval/tensor/default_tensor.h> -namespace search { -namespace features { +namespace search::features { /** * Feature executor that extracts the content from an attribute vector @@ -52,5 +50,4 @@ TensorFromAttributeExecutor<WeightedBufferType>::execute(uint32_t docId) outputs().set_object(0, *_tensor); } -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.h b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.h index 4d06088bcff..e014b040eb1 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_labels_feature.h @@ -4,8 +4,7 @@ #include "tensor_factory_blueprint.h" -namespace search { -namespace features { +namespace search::features { /** * Blueprint for a rank feature that creates a tensor from an array @@ -18,18 +17,16 @@ class TensorFromLabelsBlueprint : public TensorFactoryBlueprint { public: TensorFromLabelsBlueprint(); - virtual search::fef::Blueprint::UP createInstance() const override { + fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new TensorFromLabelsBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions(). + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions(). desc().string(). desc().string().string(); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::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; }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.h b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.h index 5cae7f25476..367eab08076 100644 --- a/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.h +++ b/searchlib/src/vespa/searchlib/features/tensor_from_weighted_set_feature.h @@ -4,8 +4,7 @@ #include "tensor_factory_blueprint.h" -namespace search { -namespace features { +namespace search::features { /** * Feature blueprint for a rank feature that creates a tensor from a weighted set. @@ -15,18 +14,16 @@ class TensorFromWeightedSetBlueprint : public TensorFactoryBlueprint { public: TensorFromWeightedSetBlueprint(); - virtual search::fef::Blueprint::UP createInstance() const override { + fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new TensorFromWeightedSetBlueprint()); } - virtual search::fef::ParameterDescriptions getDescriptions() const override { - return search::fef::ParameterDescriptions(). + fef::ParameterDescriptions getDescriptions() const override { + return fef::ParameterDescriptions(). desc().string(). desc().string().string(); } - virtual bool setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) override; - virtual search::fef::FeatureExecutor &createExecutor(const search::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; }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h index df9ab982dcb..fca101f85d4 100644 --- a/searchlib/src/vespa/searchlib/features/term_field_md_feature.h +++ b/searchlib/src/vespa/searchlib/features/term_field_md_feature.h @@ -3,13 +3,11 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/table.h> #include <vespa/searchlib/fef/itermdata.h> #include <vespa/searchlib/fef/itermfielddata.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for looking at term field match data @@ -43,6 +41,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment & env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/termdistancecalculator.h b/searchlib/src/vespa/searchlib/features/termdistancecalculator.h index ebda2b8daa1..e606e8666e3 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancecalculator.h +++ b/searchlib/src/vespa/searchlib/features/termdistancecalculator.h @@ -4,14 +4,12 @@ #include "queryterm.h" -namespace search { - -namespace fef { +namespace search::fef { class TermFieldMatchData; class MatchData; } -namespace features { +namespace search::features { /** * This class is used to calculate the minimal forward and reverse term distance @@ -82,5 +80,4 @@ public: const fef::MatchData & match, uint32_t docId, Result & r); }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/termdistancefeature.h b/searchlib/src/vespa/searchlib/features/termdistancefeature.h index 8e153072bc2..276476de21b 100644 --- a/searchlib/src/vespa/searchlib/features/termdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termdistancefeature.h @@ -3,12 +3,10 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/fef/table.h> #include "termdistancecalculator.h" -namespace search { -namespace features { +namespace search::features { /** * This struct contains parameters used by the executor. @@ -59,6 +57,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; - -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h index ea5974495ea..6d5739c690f 100644 --- a/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h +++ b/searchlib/src/vespa/searchlib/features/termeditdistancefeature.h @@ -2,8 +2,6 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> namespace search::features { diff --git a/searchlib/src/vespa/searchlib/features/termfeature.h b/searchlib/src/vespa/searchlib/features/termfeature.h index 9821bb4eb69..cb1a8621795 100644 --- a/searchlib/src/vespa/searchlib/features/termfeature.h +++ b/searchlib/src/vespa/searchlib/features/termfeature.h @@ -2,11 +2,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> -namespace search { -namespace features { +namespace search::features { /** * Implements the executor for term feature. @@ -47,4 +44,4 @@ private: uint32_t _termId; }; -}} +} diff --git a/searchlib/src/vespa/searchlib/features/terminfofeature.h b/searchlib/src/vespa/searchlib/features/terminfofeature.h index b05762972bf..0197e339e38 100644 --- a/searchlib/src/vespa/searchlib/features/terminfofeature.h +++ b/searchlib/src/vespa/searchlib/features/terminfofeature.h @@ -3,10 +3,8 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -namespace search { -namespace features { +namespace search::features { class TermInfoBlueprint : public fef::Blueprint { @@ -24,6 +22,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp index a50f042b552..c445241fe59 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.cpp @@ -1,20 +1,20 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "text_similarity_feature.h" +#include <vespa/searchlib/fef/itermdata.h> +#include <vespa/searchlib/fef/featurenamebuilder.h> -namespace search { +namespace search::features { using CollectionType = fef::FieldInfo::CollectionType; -namespace features { - namespace { struct Term { - search::fef::TermFieldHandle handle; + fef::TermFieldHandle handle; int weight; int index; - Term(search::fef::TermFieldHandle handle_in, int weight_in, int index_in) + Term(fef::TermFieldHandle handle_in, int weight_in, int index_in) : handle(handle_in), weight(weight_in), index(index_in) {} }; @@ -74,7 +74,7 @@ struct State { //----------------------------------------------------------------------------- -TextSimilarityExecutor::TextSimilarityExecutor(const search::fef::IQueryEnvironment &env, +TextSimilarityExecutor::TextSimilarityExecutor(const fef::IQueryEnvironment &env, uint32_t field_id) : _handles(), _weights(), @@ -84,11 +84,11 @@ TextSimilarityExecutor::TextSimilarityExecutor(const search::fef::IQueryEnvironm { std::vector<Term> terms; for (uint32_t i = 0; i < env.getNumTerms(); ++i) { - const search::fef::ITermData *termData = env.getTerm(i); + const fef::ITermData *termData = env.getTerm(i); if (termData->getWeight().percent() != 0) { // only consider query terms with contribution - typedef search::fef::ITermFieldRangeAdapter FRA; + typedef fef::ITermFieldRangeAdapter FRA; for (FRA iter(*termData); iter.valid(); iter.next()) { - const search::fef::ITermFieldData &tfd = iter.get(); + const fef::ITermFieldData &tfd = iter.get(); if (tfd.getFieldId() == field_id) { int term_weight = termData->getWeight().percent(); _total_term_weight += term_weight; @@ -175,14 +175,14 @@ TextSimilarityBlueprint::TextSimilarityBlueprint() : Blueprint("textSimilarity"), _field_id(fef::IllegalHandle) {} void -TextSimilarityBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment &env, - search::fef::IDumpFeatureVisitor &visitor) const +TextSimilarityBlueprint::visitDumpFeatures(const fef::IIndexEnvironment &env, + fef::IDumpFeatureVisitor &visitor) const { for (uint32_t i = 0; i < env.getNumFields(); ++i) { - const search::fef::FieldInfo &field = *env.getField(i); - if (field.type() == search::fef::FieldType::INDEX) { + const fef::FieldInfo &field = *env.getField(i); + if (field.type() == fef::FieldType::INDEX) { if (!field.isFilter() && field.collection() == CollectionType::SINGLE) { - search::fef::FeatureNameBuilder fnb; + fef::FeatureNameBuilder fnb; fnb.baseName(getBaseName()).parameter(field.name()); visitor.visitDumpFeature(fnb.output(score_output).buildName()); visitor.visitDumpFeature(fnb.output(proximity_output).buildName()); @@ -194,17 +194,17 @@ TextSimilarityBlueprint::visitDumpFeatures(const search::fef::IIndexEnvironment } } -search::fef::Blueprint::UP +fef::Blueprint::UP TextSimilarityBlueprint::createInstance() const { return Blueprint::UP(new TextSimilarityBlueprint()); } bool -TextSimilarityBlueprint::setup(const search::fef::IIndexEnvironment &env, - const search::fef::ParameterList ¶ms) +TextSimilarityBlueprint::setup(const fef::IIndexEnvironment &env, + const fef::ParameterList ¶ms) { - const search::fef::FieldInfo *field = params[0].asField(); + const fef::FieldInfo *field = params[0].asField(); _field_id = field->id(); describeOutput(score_output, "default normalized combination of other outputs"); describeOutput(proximity_output, "normalized match proximity score"); @@ -215,13 +215,12 @@ TextSimilarityBlueprint::setup(const search::fef::IIndexEnvironment &env, return true; } -search::fef::FeatureExecutor & -TextSimilarityBlueprint::createExecutor(const search::fef::IQueryEnvironment &env, vespalib::Stash &stash) const +fef::FeatureExecutor & +TextSimilarityBlueprint::createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const { return stash.create<TextSimilarityExecutor>(env, _field_id); } //----------------------------------------------------------------------------- -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h index a660f3e3e30..00406dc4993 100644 --- a/searchlib/src/vespa/searchlib/features/text_similarity_feature.h +++ b/searchlib/src/vespa/searchlib/features/text_similarity_feature.h @@ -2,11 +2,10 @@ #pragma once -#include <vespa/searchlib/fef/fef.h> +#include <vespa/searchlib/fef/blueprint.h> #include <vespa/vespalib/util/priority_queue.h> -namespace search { -namespace features { +namespace search::features { //----------------------------------------------------------------------------- @@ -67,8 +66,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override; }; -//----------------------------------------------------------------------------- - -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/utils.cpp b/searchlib/src/vespa/searchlib/features/utils.cpp index e87d356a074..86558e89ec9 100644 --- a/searchlib/src/vespa/searchlib/features/utils.cpp +++ b/searchlib/src/vespa/searchlib/features/utils.cpp @@ -2,9 +2,7 @@ #include "utils.hpp" -namespace search { -namespace features { -namespace util { +namespace search::features::util { template double strToNum<double>(vespalib::stringref str); template uint32_t strToNum<uint32_t>(vespalib::stringref str); @@ -12,7 +10,4 @@ template uint64_t strToNum<uint64_t>(vespalib::stringref str); template int32_t strToNum<int32_t>(vespalib::stringref str); template int64_t strToNum<int64_t>(vespalib::stringref str); -} // namespace util -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/utils.hpp b/searchlib/src/vespa/searchlib/features/utils.hpp index 1620d71e31e..7e6987ca14e 100644 --- a/searchlib/src/vespa/searchlib/features/utils.hpp +++ b/searchlib/src/vespa/searchlib/features/utils.hpp @@ -6,9 +6,7 @@ #include <vespa/vespalib/stllike/asciistream.h> #include <vespa/vespalib/util/exceptions.h> -namespace search { -namespace features { -namespace util { +namespace search::features::util { template <typename T> T strToNum(vespalib::stringref str) @@ -22,7 +20,5 @@ T strToNum(vespalib::stringref str) return retval; } -} // namespace util -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/valuefeature.h b/searchlib/src/vespa/searchlib/features/valuefeature.h index cb2d188d164..1cc6bd55bc1 100644 --- a/searchlib/src/vespa/searchlib/features/valuefeature.h +++ b/searchlib/src/vespa/searchlib/features/valuefeature.h @@ -3,12 +3,9 @@ #pragma once #include <vespa/searchlib/fef/blueprint.h> -#include <vespa/searchlib/fef/featureexecutor.h> -#include <vespa/searchlib/common/feature.h> #include <vector> -namespace search { -namespace features { +namespace search::features { class ValueExecutor : public fef::FeatureExecutor { @@ -51,6 +48,4 @@ public: fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override; }; -} // namespace features -} // namespace search - +} diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h index 5a778ebf698..8eedd9d98b6 100644 --- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.h +++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.h @@ -4,8 +4,7 @@ #include <vespa/vespalib/stllike/string.h> -namespace search { -namespace features { +namespace search::features { /** * Utility for parsing a string representation of a weighted set @@ -24,5 +23,4 @@ public: static void parse(const vespalib::string &input, OutputType &output); }; -} // namespace features -} // namespace search +} diff --git a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp index d67b089f5fe..1b3679bbf19 100644 --- a/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp +++ b/searchlib/src/vespa/searchlib/features/weighted_set_parser.hpp @@ -5,8 +5,7 @@ #include "weighted_set_parser.h" #include <vespa/vespalib/util/stringfmt.h> -namespace search { -namespace features { +namespace search::features { template <typename OutputType> void @@ -44,5 +43,4 @@ WeightedSetParser::parse(const vespalib::string &input, OutputType &output) } } -} // namespace features -} // namespace search +} |