aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2017-08-24 11:35:43 +0000
committerHåvard Pettersen <havardpe@oath.com>2017-08-24 11:35:43 +0000
commit6eb9afb788d7cc45ca68fc07855ac20f33bfc06d (patch)
treeba8ca9df286337a6db8db7fff99a6f7d36dab10a /searchlib/src
parent94b86e00a183b4a87b708d2d075d27311a112d15 (diff)
wire in max reduce prod join replacer
also added logging when something is replaced
Diffstat (limited to 'searchlib/src')
-rw-r--r--searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h2
-rw-r--r--searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/features/setup.cpp11
5 files changed, 15 insertions, 1 deletions
diff --git a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
index 21913dbf6bc..2419f450950 100644
--- a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
+++ b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
@@ -24,6 +24,7 @@ struct DummyExecutor : FeatureExecutor {
struct DummyExpression : IntrinsicExpression {
FeatureType type;
DummyExpression(const FeatureType &type_in) : type(type_in) {}
+ vespalib::string describe_self() const override { return "dummy"; }
const FeatureType &result_type() const override { return type; }
FeatureExecutor &create_executor(const QueryEnv &, vespalib::Stash &stash) const override {
return stash.create<DummyExecutor>();
diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp
index b18b6ea0a13..018da0e7bcd 100644
--- a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp
+++ b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_blueprint_adapter.cpp
@@ -27,6 +27,7 @@ struct IntrinsicBlueprint : IntrinsicExpression {
FeatureType type;
IntrinsicBlueprint(Blueprint::UP blueprint_in, const FeatureType &type_in)
: blueprint(std::move(blueprint_in)), type(type_in) {}
+ vespalib::string describe_self() const override { return blueprint->getName(); }
const FeatureType &result_type() const override { return type; }
FeatureExecutor &create_executor(const QueryEnv &queryEnv, vespalib::Stash &stash) const override {
return blueprint->createExecutor(queryEnv, stash);
diff --git a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h
index 395e20cedf3..34c4f34b03f 100644
--- a/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h
+++ b/searchlib/src/vespa/searchlib/features/rankingexpression/intrinsic_expression.h
@@ -3,6 +3,7 @@
#pragma once
#include <memory>
+#include <vespa/vespalib/stllike/string.h>
namespace vespalib { class Stash; }
@@ -23,6 +24,7 @@ struct IntrinsicExpression {
using FeatureExecutor = search::fef::FeatureExecutor;
using QueryEnv = search::fef::IQueryEnvironment;
using UP = std::unique_ptr<IntrinsicExpression>;
+ virtual vespalib::string describe_self() const = 0;
virtual const FeatureType &result_type() const = 0;
virtual FeatureExecutor &create_executor(const QueryEnv &queryEnv,
vespalib::Stash &stash) const = 0;
diff --git a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp
index d07841c2fe2..fa9aa03d971 100644
--- a/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp
+++ b/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.cpp
@@ -216,6 +216,7 @@ RankingExpressionBlueprint::setup(const fef::IIndexEnvironment &env,
}
_intrinsic_expression = _expression_replacer->maybe_replace(rank_function, env);
if (_intrinsic_expression) {
+ LOG(info, "%s replaced with %s", getName().c_str(), _intrinsic_expression->describe_self().c_str());
describeOutput("out", "result of intrinsic expression", _intrinsic_expression->result_type());
return true;
}
diff --git a/searchlib/src/vespa/searchlib/features/setup.cpp b/searchlib/src/vespa/searchlib/features/setup.cpp
index 34dafc07d02..867f058931f 100644
--- a/searchlib/src/vespa/searchlib/features/setup.cpp
+++ b/searchlib/src/vespa/searchlib/features/setup.cpp
@@ -53,7 +53,12 @@
#include "valuefeature.h"
#include "constant_feature.h"
+#include <vespa/searchlib/features/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 {
@@ -95,7 +100,6 @@ void setup_search_features(fef::IBlueprintRegistry & registry)
registry.addPrototype(Blueprint::SP(new QueryTermCountBlueprint()));
registry.addPrototype(Blueprint::SP(new RandomBlueprint()));
registry.addPrototype(Blueprint::SP(new RandomNormalBlueprint()));
- registry.addPrototype(Blueprint::SP(new RankingExpressionBlueprint()));
registry.addPrototype(Blueprint::SP(new RawScoreBlueprint()));
registry.addPrototype(Blueprint::SP(new SubqueriesBlueprint));
registry.addPrototype(Blueprint::SP(new TensorFromLabelsBlueprint()));
@@ -114,6 +118,11 @@ void setup_search_features(fef::IBlueprintRegistry & registry)
registry.addPrototype(Blueprint::SP(new TermEditDistanceBlueprint()));
registry.addPrototype(Blueprint::SP(new TermFieldMdBlueprint()));
registry.addPrototype(std::make_shared<ConstantBlueprint>());
+
+ // Ranking Expression
+ auto replacers = std::make_unique<ListExpressionReplacer>();
+ replacers->add(MaxReduceProdJoinReplacer::create());
+ registry.addPrototype(std::make_shared<RankingExpressionBlueprint>(std::move(replacers)));
}
} // namespace features