summaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp')
-rw-r--r--searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp29
1 files changed, 6 insertions, 23 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 6baa6581edf..251040ecfa7 100644
--- a/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
+++ b/searchlib/src/tests/features/ranking_expression/ranking_expression_test.cpp
@@ -67,38 +67,28 @@ struct SetupResult {
RankingExpressionBlueprint rank;
DummyDependencyHandler deps;
bool setup_ok;
- SetupResult(const TypeMap &object_inputs, const vespalib::string &expression,
- bool external_expression = false);
+ SetupResult(const TypeMap &object_inputs, const vespalib::string &expression);
~SetupResult();
};
SetupResult::SetupResult(const TypeMap &object_inputs,
- const vespalib::string &expression,
- bool external_expression)
+ const vespalib::string &expression)
: stash(), index_env(), query_env(&index_env), rank(make_replacer()), deps(rank), setup_ok(false)
{
rank.setName("self");
+ index_env.getProperties().add("self.rankingScript", expression);
for (const auto &input: object_inputs) {
deps.define_object_input(input.first, ValueType::from_spec(input.second));
}
- std::vector<vespalib::string> params;
- if (external_expression) {
- params.push_back("my_expr");
- index_env.addRankingExpression("my_expr", expression);
- } else {
- index_env.getProperties().add("self.rankingScript", expression);
- }
- Blueprint &bp = rank;
- setup_ok = bp.setup(index_env, params);
+ setup_ok = rank.setup(index_env, {});
EXPECT_TRUE(!deps.accept_type_mismatch);
}
SetupResult::~SetupResult() = default;
void verify_output_type(const TypeMap &object_inputs,
- const vespalib::string &expression, const FeatureType &expect,
- bool external_expression = false)
+ const vespalib::string &expression, const FeatureType &expect)
{
- SetupResult result(object_inputs, expression, external_expression);
+ SetupResult result(object_inputs, expression);
EXPECT_TRUE(result.setup_ok);
EXPECT_EQUAL(1u, result.deps.output.size());
ASSERT_EQUAL(1u, result.deps.output_type.size());
@@ -136,13 +126,6 @@ TEST("require that ranking expression can resolve to concrete complex type") {
FeatureType::object(ValueType::from_spec("tensor(x{},y{},z{})"))));
}
-TEST("require that ranking expression can be external") {
- TEST_DO(verify_output_type({}, "a*b", FeatureType::number(), true));
- TEST_DO(verify_output_type({{"b", "double"}}, "a*b", FeatureType::object(ValueType::double_type()), true));
- TEST_DO(verify_output_type({{"a", "tensor(x{},y{})"}, {"b", "tensor(y{},z{})"}}, "a*b",
- FeatureType::object(ValueType::from_spec("tensor(x{},y{},z{})")), true));
-}
-
TEST("require that setup fails for incompatible types") {
TEST_DO(verify_setup_fail({{"a", "tensor(x{},y{})"}, {"b", "tensor(y[10],z{})"}}, "a*b"));
}