summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-05-13 15:40:29 +0200
committerGitHub <noreply@github.com>2022-05-13 15:40:29 +0200
commit6c2853cc2e2b2c5777c8fe99e9e311d365b0d549 (patch)
tree9ca54e640edb1675a446d61f3bf7cc4dfe715fc0 /searchcore
parent4171f3e5248d6fd70b8fe6a2fb9f5c429485d739 (diff)
parentcd0e19b2ba89d64fa34a0c1bb5422c0a86718266 (diff)
Merge pull request #22588 from vespa-engine/havardpe/default-query-feature-tensor-value
support default tensor values for query feature
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
index 7ff5eb823ca..802d175b5af 100644
--- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
+++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp
@@ -94,6 +94,12 @@ struct Setup {
void property(const std::string &name, const std::string &val) {
properties[name] = val;
}
+ void query_feature_type(const std::string &name, const std::string &type) {
+ property(fmt("vespa.type.query.%s", name.c_str()), type);
+ }
+ void query_feature_default_value(const std::string &name, const std::string &expr) {
+ property(fmt("query(%s)", name.c_str()), expr);
+ }
void rank_expr(const std::string &name, const std::string &expr) {
property(fmt("rankingExpression(%s).rankingScript", name.c_str()), expr);
}
@@ -461,6 +467,32 @@ TEST_F("require that broken fragile model without dry-run passes verification",
//-----------------------------------------------------------------------------
+TEST_F("require that query tensor can have default value", SimpleSetup()) {
+ f.query_feature_type("foo", "tensor(x[3])");
+ f.query_feature_default_value("foo", "tensor(x[3])(x+1)");
+ f.verify_valid({"query(foo)"});
+}
+
+TEST_F("require that query tensor default value must have appropriate type", SimpleSetup()) {
+ f.query_feature_type("foo", "tensor(y[3])");
+ f.query_feature_default_value("foo", "tensor(x[3])(x+1)");
+ f.verify_invalid({"query(foo)"});
+}
+
+TEST_F("require that query tensor default value must be a valid expression", SimpleSetup()) {
+ f.query_feature_type("foo", "tensor(x[3])");
+ f.query_feature_default_value("foo", "this expression is not parseable");
+ f.verify_invalid({"query(foo)"});
+}
+
+TEST_F("require that query tensor default value expression does not need parameters", SimpleSetup()) {
+ f.query_feature_type("foo", "tensor(x[3])");
+ f.query_feature_default_value("foo", "externalSymbol");
+ f.verify_invalid({"query(foo)"});
+}
+
+//-----------------------------------------------------------------------------
+
TEST_F("cleanup files", Setup()) {
ASSERT_TRUE(vespalib::Process::run(fmt("rm -rf %s", gen_dir.c_str())));
}