summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-06-23 08:30:08 +0200
committerGitHub <noreply@github.com>2020-06-23 08:30:08 +0200
commit596000806da47c61a19447e7401b65271b48f9ec (patch)
tree43a89c586b8099ba7ed4eda3138e61d1a732261a
parent10cf873e26b28773085906a3849c33ed3aa1d90f (diff)
parent52b404f36e13de8db4bc7cab3d82ea8073ccbd5d (diff)
Merge pull request #13659 from vespa-engine/balder/globally-unique-rank-feature
Add a rank feature that will use the distribution key to provide a gl…
-rw-r--r--searchcore/src/apps/proton/proton.cpp6
-rw-r--r--searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp2
-rw-r--r--searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp2
-rw-r--r--searchlib/src/tests/features/prod_features.cpp20
-rw-r--r--searchlib/src/tests/features/prod_features.h1
-rw-r--r--searchlib/src/vespa/searchlib/features/CMakeLists.txt1
-rw-r--r--searchlib/src/vespa/searchlib/features/matchcountfeature.cpp28
-rw-r--r--searchlib/src/vespa/searchlib/features/matchcountfeature.h17
-rw-r--r--searchlib/src/vespa/searchlib/features/matchesfeature.cpp29
-rw-r--r--searchlib/src/vespa/searchlib/features/matchesfeature.h19
-rw-r--r--searchlib/src/vespa/searchlib/features/setup.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/features/uniquefeature.cpp64
-rw-r--r--searchlib/src/vespa/searchlib/features/uniquefeature.h32
-rw-r--r--searchlib/src/vespa/searchlib/fef/iindexenvironment.h2
-rw-r--r--searchlib/src/vespa/searchlib/fef/test/indexenvironment.h3
-rw-r--r--searchlib/src/vespa/searchlib/fef/test/rankresult.cpp8
-rw-r--r--searchlib/src/vespa/searchlib/fef/test/rankresult.h11
-rw-r--r--storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp4
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/indexenvironment.h3
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp5
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp2
24 files changed, 206 insertions, 76 deletions
diff --git a/searchcore/src/apps/proton/proton.cpp b/searchcore/src/apps/proton/proton.cpp
index 8f2be3257fc..8709b0d01b1 100644
--- a/searchcore/src/apps/proton/proton.cpp
+++ b/searchcore/src/apps/proton/proton.cpp
@@ -124,11 +124,9 @@ public:
int64_t getGeneration() const override;
};
-ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri &
- configUri,
+ProtonServiceLayerProcess::ProtonServiceLayerProcess(const config::ConfigUri & configUri,
proton::Proton & proton,
- PersistenceProvider *
- downPersistence)
+ PersistenceProvider * downPersistence)
: ServiceLayerProcess(configUri),
_proton(proton),
_metricManager(nullptr),
diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
index 721ee9978b0..118cad4d8ef 100644
--- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
+++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
@@ -79,7 +79,7 @@ App::verify(const search::index::Schema &schema,
const search::fef::Properties &props,
const IConstantValueRepo &repo)
{
- proton::matching::IndexEnvironment indexEnv(schema, props, repo);
+ proton::matching::IndexEnvironment indexEnv(0, schema, props, repo);
search::fef::BlueprintFactory factory;
search::features::setup_search_features(factory);
search::fef::test::setup_fef_test_plugin(factory);
diff --git a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp
index 8c651c72df0..932ab6f4d14 100644
--- a/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp
+++ b/searchcore/src/tests/proton/matching/index_environment/index_environment_test.cpp
@@ -42,7 +42,7 @@ struct Fixture {
Fixture(Schema::UP schema_)
: repo(),
schema(std::move(schema_)),
- env(*schema, Properties(), repo)
+ env(7, *schema, Properties(), repo)
{
}
const FieldInfo *assertField(size_t idx,
@@ -84,6 +84,11 @@ TEST_F("require that document meta store is always extracted in index environmen
TEST_DO(f.assertHiddenAttributeField(0, "[documentmetastore]", DataType::RAW, CollectionType::SINGLE));
}
+TEST_F("require that distribution key is visible in index environment", Fixture(buildEmptySchema()))
+{
+ ASSERT_EQUAL(7u, f.env.getDistributionKey());
+}
+
TEST_F("require that imported attribute fields are extracted in index environment", Fixture(buildSchema()))
{
ASSERT_EQUAL(3u, f.env.getNumFields());
diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
index b86750f15ee..d6d185ccab4 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.cpp
@@ -61,7 +61,8 @@ IndexEnvironment::insertField(const search::fef::FieldInfo &field)
_fields.push_back(field);
}
-IndexEnvironment::IndexEnvironment(const search::index::Schema &schema,
+IndexEnvironment::IndexEnvironment(uint32_t distributionKey,
+ const search::index::Schema &schema,
const search::fef::Properties &props,
const IConstantValueRepo &constantValueRepo)
: _tableManager(),
@@ -69,7 +70,8 @@ IndexEnvironment::IndexEnvironment(const search::index::Schema &schema,
_fieldNames(),
_fields(),
_motivation(UNKNOWN),
- _constantValueRepo(constantValueRepo)
+ _constantValueRepo(constantValueRepo),
+ _distributionKey(distributionKey)
{
_tableManager.addFactory(std::make_shared<search::fef::FunctionTableFactory>(256));
extractFields(schema);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
index 5696fbf2379..7da45909577 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/indexenvironment.h
@@ -25,6 +25,8 @@ private:
std::vector<search::fef::FieldInfo> _fields;
mutable FeatureMotivation _motivation;
const IConstantValueRepo &_constantValueRepo;
+ uint32_t _distributionKey;
+
/**
* Extract field information from the given schema and populate
@@ -38,11 +40,13 @@ public:
* Sets up this index environment based on the given schema and
* properties.
*
+ * @param distributionKey the distribution key for this node.
* @param schema the index schema
* @param props config
* @param constantValueRepo repo used to access constant values for ranking
**/
- IndexEnvironment(const search::index::Schema &schema,
+ IndexEnvironment(uint32_t distributionKey,
+ const search::index::Schema &schema,
const search::fef::Properties &props,
const IConstantValueRepo &constantValueRepo);
@@ -55,6 +59,7 @@ public:
void hintFeatureMotivation(FeatureMotivation motivation) const override;
void hintFieldAccess(uint32_t fieldId) const override;
void hintAttributeAccess(const string &name) const override;
+ uint32_t getDistributionKey() const override { return _distributionKey; }
vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override {
return _constantValueRepo.getConstant(name);
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 93b4f63060f..735070002eb 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -100,7 +100,7 @@ handleGroupingSession(SessionManager &sessionMgr, GroupingContext & groupingCont
Matcher::Matcher(const search::index::Schema &schema, const Properties &props, const vespalib::Clock &clock,
QueryLimiter &queryLimiter, const IConstantValueRepo &constantValueRepo, uint32_t distributionKey)
- : _indexEnv(schema, props, constantValueRepo),
+ : _indexEnv(distributionKey, schema, props, constantValueRepo),
_blueprintFactory(),
_rankSetup(),
_viewResolver(ViewResolver::createFromSchema(schema)),
diff --git a/searchlib/src/tests/features/prod_features.cpp b/searchlib/src/tests/features/prod_features.cpp
index 3f71c9f85ea..c50c7a12698 100644
--- a/searchlib/src/tests/features/prod_features.cpp
+++ b/searchlib/src/tests/features/prod_features.cpp
@@ -34,6 +34,7 @@
#include <vespa/searchlib/features/setup.h>
#include <vespa/searchlib/features/termfeature.h>
#include <vespa/searchlib/features/utils.h>
+#include <vespa/searchlib/features/uniquefeature.h>
#include <vespa/searchlib/features/weighted_set_parser.hpp>
#include <vespa/searchlib/fef/featurenamebuilder.h>
#include <vespa/searchlib/fef/indexproperties.h>
@@ -112,6 +113,7 @@ Test::Main()
TEST_DO(testTerm()); TEST_FLUSH();
TEST_DO(testTermDistance()); TEST_FLUSH();
TEST_DO(testUtils()); TEST_FLUSH();
+ TEST_DO(testUnique()); TEST_FLUSH();
TEST_DONE();
return 0;
@@ -1564,6 +1566,24 @@ Test::testMatchCount()
}
void
+Test::testUnique()
+{
+ {
+ UniqueBlueprint bp;
+ EXPECT_TRUE(assertCreateInstance(bp, "unique"));
+ FtFeatureTest ft(_factory, "");
+ StringList params, in, out;
+ FT_SETUP_OK(bp, ft.getIndexEnv(), params, in, out.add("out"));
+ FT_DUMP_EMPTY(_factory, "unique");
+ }
+ FtFeatureTest ft(_factory, "unique");
+ ASSERT_TRUE(ft.setup());
+ EXPECT_TRUE(ft.execute(0x10003,0, 1));
+ EXPECT_TRUE(ft.execute(0x70003,0, 7));
+
+}
+
+void
Test::testMatches()
{
{ // Test blueprint.
diff --git a/searchlib/src/tests/features/prod_features.h b/searchlib/src/tests/features/prod_features.h
index 6d30dd3fcd8..7f444e8ff60 100644
--- a/searchlib/src/tests/features/prod_features.h
+++ b/searchlib/src/tests/features/prod_features.h
@@ -39,6 +39,7 @@ public:
void testRankingExpression();
void testTerm();
void testTermDistance();
+ void testUnique();
static void testUtils();
static void setupForDotProductTest(FtFeatureTest & ft);
diff --git a/searchlib/src/vespa/searchlib/features/CMakeLists.txt b/searchlib/src/vespa/searchlib/features/CMakeLists.txt
index 727ace182eb..a3ce67c4bf6 100644
--- a/searchlib/src/vespa/searchlib/features/CMakeLists.txt
+++ b/searchlib/src/vespa/searchlib/features/CMakeLists.txt
@@ -63,6 +63,7 @@ vespa_add_library(searchlib_features OBJECT
termfeature.cpp
terminfofeature.cpp
text_similarity_feature.cpp
+ uniquefeature.cpp
utils.cpp
valuefeature.cpp
weighted_set_parser.cpp
diff --git a/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
index f19e32793a1..5a14e65bd28 100644
--- a/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.cpp
@@ -9,6 +9,27 @@ using namespace search::fef;
namespace search::features {
+namespace {
+
+/**
+* Implements the executor for the matchCount feature for index and
+* attribute fields.
+*/
+class MatchCountExecutor : public fef::FeatureExecutor {
+private:
+ std::vector<fef::TermFieldHandle> _handles;
+ const fef::MatchData *_md;
+
+ void handle_bind_match_data(const fef::MatchData &md) override {
+ _md = &md;
+ }
+
+public:
+ MatchCountExecutor(uint32_t fieldId, const fef::IQueryEnvironment &env);
+
+ void execute(uint32_t docId) override;
+};
+
MatchCountExecutor::MatchCountExecutor(uint32_t fieldId, const IQueryEnvironment &env)
: FeatureExecutor(),
_handles(),
@@ -23,8 +44,7 @@ MatchCountExecutor::MatchCountExecutor(uint32_t fieldId, const IQueryEnvironment
}
void
-MatchCountExecutor::execute(uint32_t docId)
-{
+MatchCountExecutor::execute(uint32_t docId) {
size_t output = 0;
for (uint32_t i = 0; i < _handles.size(); ++i) {
const TermFieldMatchData *tfmd = _md->resolveTermField(_handles[i]);
@@ -35,10 +55,6 @@ MatchCountExecutor::execute(uint32_t docId)
outputs().set_number(0, static_cast<feature_t>(output));
}
-void
-MatchCountExecutor::handle_bind_match_data(const MatchData &md)
-{
- _md = &md;
}
MatchCountBlueprint::MatchCountBlueprint() :
diff --git a/searchlib/src/vespa/searchlib/features/matchcountfeature.h b/searchlib/src/vespa/searchlib/features/matchcountfeature.h
index a81f4f084b8..88c577f8b24 100644
--- a/searchlib/src/vespa/searchlib/features/matchcountfeature.h
+++ b/searchlib/src/vespa/searchlib/features/matchcountfeature.h
@@ -7,23 +7,6 @@
namespace search::features {
/**
- * Implements the executor for the matchCount feature for index and
- * attribute fields.
- */
-class MatchCountExecutor : public fef::FeatureExecutor
-{
-private:
- std::vector<fef::TermFieldHandle> _handles;
- const fef::MatchData *_md;
-
- void handle_bind_match_data(const fef::MatchData &md) override;
-
-public:
- MatchCountExecutor(uint32_t fieldId, const fef::IQueryEnvironment &env);
- void execute(uint32_t docId) override;
-};
-
-/**
* Implements the blueprint for the matchCount executor.
*
* matchCount(name)
diff --git a/searchlib/src/vespa/searchlib/features/matchesfeature.cpp b/searchlib/src/vespa/searchlib/features/matchesfeature.cpp
index 8d72978adf7..6fbb2f5d5f2 100644
--- a/searchlib/src/vespa/searchlib/features/matchesfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/matchesfeature.cpp
@@ -11,6 +11,27 @@ using namespace search::fef;
namespace search::features {
+namespace {
+
+/**
+ * Implements the executor for the matches feature for index and
+ * attribute fields.
+ */
+class MatchesExecutor : public fef::FeatureExecutor {
+private:
+ std::vector<fef::TermFieldHandle> _handles;
+ const fef::MatchData *_md;
+
+ void handle_bind_match_data(const fef::MatchData &md) override;
+
+public:
+ MatchesExecutor(uint32_t fieldId,
+ const fef::IQueryEnvironment &env,
+ uint32_t begin, uint32_t end);
+
+ void execute(uint32_t docId) override;
+};
+
MatchesExecutor::MatchesExecutor(uint32_t fieldId,
const search::fef::IQueryEnvironment &env,
uint32_t begin, uint32_t end)
@@ -27,8 +48,7 @@ MatchesExecutor::MatchesExecutor(uint32_t fieldId,
}
void
-MatchesExecutor::execute(uint32_t docId)
-{
+MatchesExecutor::execute(uint32_t docId) {
size_t output = 0;
for (uint32_t i = 0; i < _handles.size(); ++i) {
const TermFieldMatchData *tfmd = _md->resolveTermField(_handles[i]);
@@ -41,11 +61,12 @@ MatchesExecutor::execute(uint32_t docId)
}
void
-MatchesExecutor::handle_bind_match_data(const MatchData &md)
-{
+MatchesExecutor::handle_bind_match_data(const MatchData &md) {
_md = &md;
}
+}
+
MatchesBlueprint::MatchesBlueprint() :
Blueprint("matches"),
_field(nullptr),
diff --git a/searchlib/src/vespa/searchlib/features/matchesfeature.h b/searchlib/src/vespa/searchlib/features/matchesfeature.h
index 53c6151a713..671d1fe31c0 100644
--- a/searchlib/src/vespa/searchlib/features/matchesfeature.h
+++ b/searchlib/src/vespa/searchlib/features/matchesfeature.h
@@ -7,25 +7,6 @@
namespace search::features {
/**
- * Implements the executor for the matches feature for index and
- * attribute fields.
- */
-class MatchesExecutor : public fef::FeatureExecutor
-{
-private:
- std::vector<fef::TermFieldHandle> _handles;
- const fef::MatchData *_md;
-
- void handle_bind_match_data(const fef::MatchData &md) override;
-
-public:
- MatchesExecutor(uint32_t fieldId,
- const fef::IQueryEnvironment &env,
- uint32_t begin, uint32_t end);
- void execute(uint32_t docId) override;
-};
-
-/**
* Implements the blueprint for the matches executor.
*
* matches(name)
diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp
index bf8b59f100c..ea6ec842a00 100644
--- a/searchlib/src/vespa/searchlib/features/setup.cpp
+++ b/searchlib/src/vespa/searchlib/features/setup.cpp
@@ -53,6 +53,7 @@
#include "termfeature.h"
#include "terminfofeature.h"
#include "text_similarity_feature.h"
+#include "uniquefeature.h"
#include "valuefeature.h"
#include "max_reduce_prod_join_replacer.h"
@@ -121,6 +122,8 @@ void setup_search_features(fef::IBlueprintRegistry & registry)
registry.addPrototype(std::make_shared<TermEditDistanceBlueprint>());
registry.addPrototype(std::make_shared<TermFieldMdBlueprint>());
registry.addPrototype(std::make_shared<ConstantBlueprint>());
+ registry.addPrototype(std::make_shared<UniqueBlueprint>());
+
// Ranking Expression
auto replacers = std::make_unique<ListExpressionReplacer>();
diff --git a/searchlib/src/vespa/searchlib/features/uniquefeature.cpp b/searchlib/src/vespa/searchlib/features/uniquefeature.cpp
new file mode 100644
index 00000000000..73ac4a1178e
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/features/uniquefeature.cpp
@@ -0,0 +1,64 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "uniquefeature.h"
+#include <vespa/vespalib/util/stash.h>
+
+using namespace search::fef;
+
+namespace search::features {
+
+namespace {
+
+/**
+ * Implements the executor for combining lid and distribution key to form a globally unique value.
+ */
+class UniqueLidAndDistributionKeyExecutor : public fef::FeatureExecutor {
+private:
+ uint32_t _distributionKey;
+
+public:
+ UniqueLidAndDistributionKeyExecutor(uint32_t distributionKey)
+ : _distributionKey(distributionKey)
+ {
+ assert( _distributionKey < 0x10000);
+ }
+
+ void execute(uint32_t docId) override {
+ outputs().set_number(0, (uint64_t(docId) << 16u) | _distributionKey);
+ }
+};
+
+}
+
+UniqueBlueprint::UniqueBlueprint() :
+ Blueprint("unique"),
+ _distributionKey(0)
+{
+}
+
+void
+UniqueBlueprint::visitDumpFeatures(const IIndexEnvironment &, IDumpFeatureVisitor &) const
+{
+}
+
+bool
+UniqueBlueprint::setup(const IIndexEnvironment & env, const ParameterList & )
+{
+ _distributionKey = env.getDistributionKey();
+ describeOutput("out", "Returns (lid << 16) | distributionKey");
+ return true;
+}
+
+Blueprint::UP
+UniqueBlueprint::createInstance() const
+{
+ return std::make_unique<UniqueBlueprint>();
+}
+
+FeatureExecutor &
+UniqueBlueprint::createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const
+{
+ return stash.create<UniqueLidAndDistributionKeyExecutor>(_distributionKey);
+}
+
+}
diff --git a/searchlib/src/vespa/searchlib/features/uniquefeature.h b/searchlib/src/vespa/searchlib/features/uniquefeature.h
new file mode 100644
index 00000000000..f21a427762a
--- /dev/null
+++ b/searchlib/src/vespa/searchlib/features/uniquefeature.h
@@ -0,0 +1,32 @@
+// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include <vespa/searchlib/fef/blueprint.h>
+
+namespace search::features {
+
+/**
+ * Implements the blueprint for the unique rank feature.
+ *
+ * This will compute a globally unique id based on lid and distribution key.
+ * Cheap way to get deterministic ordering
+ * It will change if documents change lid.
+ */
+
+class UniqueBlueprint : public fef::Blueprint
+{
+private:
+ uint32_t _distributionKey;
+public:
+ UniqueBlueprint();
+ 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();
+ }
+ bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override;
+ fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;
+};
+
+}
diff --git a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
index 7cf3f4e140c..bdeead3e852 100644
--- a/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
+++ b/searchlib/src/vespa/searchlib/fef/iindexenvironment.h
@@ -120,6 +120,8 @@ public:
*/
virtual std::unique_ptr<vespalib::eval::ConstantValue> getConstantValue(const vespalib::string &name) const = 0;
+ virtual uint32_t getDistributionKey() const = 0;
+
/**
* Virtual destructor to allow safe subclassing.
**/
diff --git a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h
index 09c64fcac7a..d84cebc7f52 100644
--- a/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h
+++ b/searchlib/src/vespa/searchlib/fef/test/indexenvironment.h
@@ -60,6 +60,7 @@ public:
void hintFeatureMotivation(FeatureMotivation) const override {}
void hintFieldAccess(uint32_t) const override {}
void hintAttributeAccess(const string &) const override {}
+ uint32_t getDistributionKey() const override { return 3; }
/** Returns a reference to the properties map of this. */
Properties &getProperties() { return _properties; }
@@ -76,7 +77,7 @@ public:
/** Returns a reference to the table manager of this. */
TableManager &getTableManager() { return _tableMan; }
- virtual vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override;
+ vespalib::eval::ConstantValue::UP getConstantValue(const vespalib::string &name) const override;
void addConstantValue(const vespalib::string &name,
vespalib::eval::ValueType type,
diff --git a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp
index abaaa1d100e..15d4ce317cc 100644
--- a/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp
+++ b/searchlib/src/vespa/searchlib/fef/test/rankresult.cpp
@@ -6,9 +6,7 @@
#include <vespa/log/log.h>
LOG_SETUP(".fef.rankresult");
-namespace search {
-namespace fef {
-namespace test {
+namespace search::fef::test {
RankResult::RankResult() :
_rankScores(),
@@ -107,6 +105,4 @@ std::ostream & operator<<(std::ostream & os, const RankResult & rhs) {
return os << "]";
}
-} // namespace test
-} // namespace fef
-} // namespace search
+}
diff --git a/searchlib/src/vespa/searchlib/fef/test/rankresult.h b/searchlib/src/vespa/searchlib/fef/test/rankresult.h
index 46ae3673e06..8c1efdbb36c 100644
--- a/searchlib/src/vespa/searchlib/fef/test/rankresult.h
+++ b/searchlib/src/vespa/searchlib/fef/test/rankresult.h
@@ -2,13 +2,11 @@
#pragma once
#include <vespa/searchlib/common/feature.h>
-#include <map>
#include <vespa/vespalib/stllike/string.h>
#include <vector>
+#include <map>
-namespace search {
-namespace fef {
-namespace test {
+namespace search::fef::test {
class RankResult {
public:
@@ -107,7 +105,4 @@ private:
double _epsilon;
};
-} // namespace test
-} // namespace fef
-} // namespace search
-
+}
diff --git a/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp b/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp
index af9ba53ef70..bde93b9e4fb 100644
--- a/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp
+++ b/storageserver/src/vespa/storageserver/app/servicelayerprocess.cpp
@@ -14,7 +14,7 @@ ServiceLayerProcess::ServiceLayerProcess(const config::ConfigUri & configUri)
{
}
-ServiceLayerProcess::~ServiceLayerProcess() {}
+ServiceLayerProcess::~ServiceLayerProcess() = default;
void
ServiceLayerProcess::shutdown()
@@ -26,7 +26,7 @@ ServiceLayerProcess::shutdown()
void
ServiceLayerProcess::createNode()
{
- _externalVisitors["searchvisitor"].reset(new streaming::SearchVisitorFactory(_configUri));
+ _externalVisitors["searchvisitor"] = std::make_shared<streaming::SearchVisitorFactory>(_configUri);
setupProvider();
_node = std::make_unique<ServiceLayerNode>(_configUri, _context, *this, getProvider(), _externalVisitors);
_node->init();
diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
index 5d684c4fea4..ac6836b08c5 100644
--- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
+++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
@@ -81,6 +81,9 @@ public:
const std::set<vespalib::string> & getHintedDumpAttributes() const { return _dumpAttributes; }
+ //TODO Wire in proper distribution key
+ uint32_t getDistributionKey() const override { return 0; }
+
};
} // namespace streaming
diff --git a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
index 8dbbbba98cf..2c5f5eeb1b7 100644
--- a/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/rankmanager.cpp
@@ -176,7 +176,8 @@ RankManager::Snapshot::setup(const RankManager & rm, const RankProfilesConfig &
return setup(rm);
}
-void RankManager::notify(const vsm::VSMConfigSnapshot & snap)
+void
+RankManager::notify(const vsm::VSMConfigSnapshot & snap)
{
configureRankProfiles(*snap.getConfig<RankProfilesConfig>());
}
@@ -187,7 +188,7 @@ RankManager::configureRankProfiles(const RankProfilesConfig & cfg)
{
LOG(debug, "configureRankProfiles(): Size of cfg rankprofiles: %zd", cfg.rankprofile.size());
- std::unique_ptr<Snapshot> snapshot(new Snapshot());
+ auto snapshot = std::make_unique<Snapshot>();
if (snapshot->setup(*this, cfg)) {
_snapshot.set(snapshot.release());
_snapshot.latch(); // switch to the new config object
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index cc48ad09aa6..76ef0f23dd2 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -357,7 +357,7 @@ SearchVisitorFactory::SearchVisitorFactory(const config::ConfigUri & configUri)
VisitorEnvironment::UP
SearchVisitorFactory::makeVisitorEnvironment(StorageComponent&)
{
- return VisitorEnvironment::UP(new SearchEnvironment(_configUri));
+ return std::make_unique<SearchEnvironment>(_configUri);
}
storage::Visitor*