summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArne H Juul <arnej@yahooinc.com>2022-01-13 15:01:26 +0000
committerArne H Juul <arnej@yahooinc.com>2022-01-13 15:01:45 +0000
commit3429fd4207c56f6e156a376bc9a4058de37160ce (patch)
tree654da93562031112f928c679cf62bdc4f35e0e5a
parentb26875a70857623f21587c2cac39b352d8e30508 (diff)
test optional fill of feature rename properties
-rw-r--r--config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java7
-rw-r--r--config-model/src/test/derived/renamedfeatures/foo.sd82
-rw-r--r--config-model/src/test/derived/renamedfeatures/rank-profiles.cfg82
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java7
4 files changed, 178 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
index c148bb0e6e4..28933a37ffa 100644
--- a/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
+++ b/config-model/src/main/java/com/yahoo/config/model/deploy/TestProperties.java
@@ -75,6 +75,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
private int maxCompactBuffers = 1;
private boolean failDeploymentWithInvalidJvmOptions = false;
private String persistenceAsyncThrottling = "UNLIMITED";
+ private boolean avoidRenamingSummaryFeatures = false;
@Override public ModelContext.FeatureFlags featureFlags() { return this; }
@Override public boolean multitenant() { return multitenant; }
@@ -130,6 +131,7 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
@Override public int maxCompactBuffers() { return maxCompactBuffers; }
@Override public boolean failDeploymentWithInvalidJvmOptions() { return failDeploymentWithInvalidJvmOptions; }
@Override public String persistenceAsyncThrottling() { return persistenceAsyncThrottling; }
+ @Override public boolean avoidRenamingSummaryFeatures() { return this.avoidRenamingSummaryFeatures; }
public TestProperties maxUnCommittedMemory(int maxUnCommittedMemory) {
this.maxUnCommittedMemory = maxUnCommittedMemory;
@@ -342,6 +344,11 @@ public class TestProperties implements ModelContext.Properties, ModelContext.Fea
return this;
}
+ public TestProperties setAvoidRenamingSummaryFeatures(boolean value) {
+ this.avoidRenamingSummaryFeatures = value;
+ return this;
+ }
+
public static class Spec implements ConfigServerSpec {
private final String hostName;
diff --git a/config-model/src/test/derived/renamedfeatures/foo.sd b/config-model/src/test/derived/renamedfeatures/foo.sd
new file mode 100644
index 00000000000..f7884dd937d
--- /dev/null
+++ b/config-model/src/test/derived/renamedfeatures/foo.sd
@@ -0,0 +1,82 @@
+# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+search foo {
+
+ document foo {
+ field title type string {
+ indexing: summary | index
+ }
+ field year type int {
+ indexing: attribute
+ }
+ field foo1 type double {
+ indexing: attribute
+ }
+ field foo2 type double {
+ indexing: attribute
+ }
+ field bar1 type double {
+ indexing: attribute
+ }
+ field bar2 type double {
+ indexing: attribute
+ }
+ field t1 type tensor(m{},v[3]) {
+ indexing: attribute
+ }
+ }
+
+ rank-profile default {
+ function myplus() {
+ expression: attribute(foo1)+attribute(foo2)
+ }
+ function mymul() {
+ expression: attribute(t1)*query(fromq)
+ }
+ first-phase {
+ expression: classicRank
+ }
+ rank-features: attribute(foo1).out attribute(bar1)
+ rank-features { myplus mymul }
+ ignore-default-rank-features
+ }
+
+ rank-profile withsf {
+ function myplus() {
+ expression: attribute(foo1)+attribute(foo2)
+ }
+ function mymul() {
+ expression: attribute(t1)*query(fromq)
+ }
+ first-phase {
+ expression { attribute(year) }
+ }
+ summary-features: attribute(foo1).out attribute(bar1)
+ summary-features {
+ myplus
+ rankingExpression(mymul)
+ }
+ }
+
+ rank-profile withmf {
+ function myplus() {
+ expression: attribute(foo1)+attribute(foo2)
+ }
+ function mymul() {
+ expression: attribute(t1)*query(fromq)
+ }
+ first-phase {
+ expression: attribute(foo1)
+ }
+ second-phase {
+ expression: attribute(foo2)
+ }
+ match-features: attribute(foo1).out attribute(bar1)
+ match-features {
+ rankingExpression(myplus)
+ mymul
+ firstPhase
+ secondPhase
+ }
+ }
+
+}
diff --git a/config-model/src/test/derived/renamedfeatures/rank-profiles.cfg b/config-model/src/test/derived/renamedfeatures/rank-profiles.cfg
new file mode 100644
index 00000000000..b78866fdf05
--- /dev/null
+++ b/config-model/src/test/derived/renamedfeatures/rank-profiles.cfg
@@ -0,0 +1,82 @@
+rankprofile[0].name "default"
+rankprofile[0].fef.property[0].name "rankingExpression(myplus).rankingScript"
+rankprofile[0].fef.property[0].value "attribute(foo1) + attribute(foo2)"
+rankprofile[0].fef.property[1].name "rankingExpression(mymul).rankingScript"
+rankprofile[0].fef.property[1].value "attribute(t1) * query(fromq)"
+rankprofile[0].fef.property[2].name "rankingExpression(mymul).type"
+rankprofile[0].fef.property[2].value "tensor(m{},v[3])"
+rankprofile[0].fef.property[3].name "vespa.rank.firstphase"
+rankprofile[0].fef.property[3].value "classicRank"
+rankprofile[0].fef.property[4].name "vespa.dump.feature"
+rankprofile[0].fef.property[4].value "attribute(foo1).out"
+rankprofile[0].fef.property[5].name "vespa.dump.feature"
+rankprofile[0].fef.property[5].value "attribute(bar1)"
+rankprofile[0].fef.property[6].name "vespa.dump.feature"
+rankprofile[0].fef.property[6].value "myplus"
+rankprofile[0].fef.property[7].name "vespa.dump.feature"
+rankprofile[0].fef.property[7].value "mymul"
+rankprofile[0].fef.property[8].name "vespa.dump.ignoredefaultfeatures"
+rankprofile[0].fef.property[8].value "true"
+rankprofile[0].fef.property[9].name "vespa.type.attribute.t1"
+rankprofile[0].fef.property[9].value "tensor(m{},v[3])"
+rankprofile[1].name "unranked"
+rankprofile[1].fef.property[0].name "vespa.rank.firstphase"
+rankprofile[1].fef.property[0].value "value(0)"
+rankprofile[1].fef.property[1].name "vespa.hitcollector.heapsize"
+rankprofile[1].fef.property[1].value "0"
+rankprofile[1].fef.property[2].name "vespa.hitcollector.arraysize"
+rankprofile[1].fef.property[2].value "0"
+rankprofile[1].fef.property[3].name "vespa.dump.ignoredefaultfeatures"
+rankprofile[1].fef.property[3].value "true"
+rankprofile[1].fef.property[4].name "vespa.type.attribute.t1"
+rankprofile[1].fef.property[4].value "tensor(m{},v[3])"
+rankprofile[2].name "withsf"
+rankprofile[2].fef.property[0].name "rankingExpression(myplus).rankingScript"
+rankprofile[2].fef.property[0].value "attribute(foo1) + attribute(foo2)"
+rankprofile[2].fef.property[1].name "rankingExpression(mymul).rankingScript"
+rankprofile[2].fef.property[1].value "attribute(t1) * query(fromq)"
+rankprofile[2].fef.property[2].name "rankingExpression(mymul).type"
+rankprofile[2].fef.property[2].value "tensor(m{},v[3])"
+rankprofile[2].fef.property[3].name "vespa.rank.firstphase"
+rankprofile[2].fef.property[3].value "attribute(year)"
+rankprofile[2].fef.property[4].name "vespa.summary.feature"
+rankprofile[2].fef.property[4].value "attribute(foo1).out"
+rankprofile[2].fef.property[5].name "vespa.summary.feature"
+rankprofile[2].fef.property[5].value "attribute(bar1)"
+rankprofile[2].fef.property[6].name "vespa.summary.feature"
+rankprofile[2].fef.property[6].value "rankingExpression(mymul)"
+rankprofile[2].fef.property[7].name "vespa.summary.feature"
+rankprofile[2].fef.property[7].value "rankingExpression(myplus)"
+rankprofile[2].fef.property[8].name "vespa.feature.rename"
+rankprofile[2].fef.property[8].value "rankingExpression(myplus)"
+rankprofile[2].fef.property[9].name "vespa.feature.rename"
+rankprofile[2].fef.property[9].value "myplus"
+rankprofile[2].fef.property[10].name "vespa.type.attribute.t1"
+rankprofile[2].fef.property[10].value "tensor(m{},v[3])"
+rankprofile[3].name "withmf"
+rankprofile[3].fef.property[0].name "rankingExpression(mymul).rankingScript"
+rankprofile[3].fef.property[0].value "attribute(t1) * query(fromq)"
+rankprofile[3].fef.property[1].name "rankingExpression(myplus).rankingScript"
+rankprofile[3].fef.property[1].value "attribute(foo1) + attribute(foo2)"
+rankprofile[3].fef.property[2].name "vespa.rank.firstphase"
+rankprofile[3].fef.property[2].value "attribute(foo1)"
+rankprofile[3].fef.property[3].name "vespa.rank.secondphase"
+rankprofile[3].fef.property[3].value "attribute(foo2)"
+rankprofile[3].fef.property[4].name "vespa.match.feature"
+rankprofile[3].fef.property[4].value "attribute(foo1).out"
+rankprofile[3].fef.property[5].name "vespa.match.feature"
+rankprofile[3].fef.property[5].value "attribute(bar1)"
+rankprofile[3].fef.property[6].name "vespa.match.feature"
+rankprofile[3].fef.property[6].value "rankingExpression(myplus)"
+rankprofile[3].fef.property[7].name "vespa.match.feature"
+rankprofile[3].fef.property[7].value "firstPhase"
+rankprofile[3].fef.property[8].name "vespa.match.feature"
+rankprofile[3].fef.property[8].value "secondPhase"
+rankprofile[3].fef.property[9].name "vespa.match.feature"
+rankprofile[3].fef.property[9].value "rankingExpression(mymul)"
+rankprofile[3].fef.property[10].name "vespa.feature.rename"
+rankprofile[3].fef.property[10].value "rankingExpression(mymul)"
+rankprofile[3].fef.property[11].name "vespa.feature.rename"
+rankprofile[3].fef.property[11].value "mymul"
+rankprofile[3].fef.property[12].name "vespa.type.attribute.t1"
+rankprofile[3].fef.property[12].value "tensor(m{},v[3])" \ No newline at end of file
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
index fda3e6c16c3..8cc8967269a 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/ExportingTestCase.java
@@ -108,6 +108,13 @@ public class ExportingTestCase extends AbstractExportingTestCase {
}
@Test
+ public void testAvoidRenamingRankingExpression() throws IOException, ParseException {
+ assertCorrectDeriving("renamedfeatures", "foo",
+ new TestProperties().setAvoidRenamingSummaryFeatures(true),
+ new TestableDeployLogger());
+ }
+
+ @Test
public void testMlr() throws IOException, ParseException {
assertCorrectDeriving("mlr");
}