summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2022-02-15 18:10:46 +0100
committerGitHub <noreply@github.com>2022-02-15 18:10:46 +0100
commit2ebbc783aa190ea40aac166638f01cfc58a00c91 (patch)
tree5502b210ff0d11c94fb40910b5985d15ed8e286d /config-model
parentf21d76a13a8c569897643293a984374ae08e3a3e (diff)
parentd030467ed4b417c910bfb063a5e77e4a49553d82 (diff)
Merge pull request #21195 from vespa-engine/bratseth/allow-quoted-string-slice-labels
Allow quoted string slice labels
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/test/derived/slice/query-profiles/default.xml3
-rw-r--r--config-model/src/test/derived/slice/query-profiles/types/DefaultQueryProfileType.xml4
-rw-r--r--config-model/src/test/derived/slice/test.sd21
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SliceTestCase.java27
4 files changed, 55 insertions, 0 deletions
diff --git a/config-model/src/test/derived/slice/query-profiles/default.xml b/config-model/src/test/derived/slice/query-profiles/default.xml
new file mode 100644
index 00000000000..2535ca895ed
--- /dev/null
+++ b/config-model/src/test/derived/slice/query-profiles/default.xml
@@ -0,0 +1,3 @@
+<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<query-profile id="default" type="DefaultQueryProfileType">
+</query-profile>
diff --git a/config-model/src/test/derived/slice/query-profiles/types/DefaultQueryProfileType.xml b/config-model/src/test/derived/slice/query-profiles/types/DefaultQueryProfileType.xml
new file mode 100644
index 00000000000..50970d8743f
--- /dev/null
+++ b/config-model/src/test/derived/slice/query-profiles/types/DefaultQueryProfileType.xml
@@ -0,0 +1,4 @@
+<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -->
+<query-profile-type id="DefaultQueryProfileType" inherits="native">
+ <field name="ranking.features.query(myTensor)" type="tensor&lt;float&gt;(key{})" />
+</query-profile-type>
diff --git a/config-model/src/test/derived/slice/test.sd b/config-model/src/test/derived/slice/test.sd
new file mode 100644
index 00000000000..fbb581d1b1d
--- /dev/null
+++ b/config-model/src/test/derived/slice/test.sd
@@ -0,0 +1,21 @@
+search test {
+
+ document test {
+ }
+
+ rank-profile parent {
+
+ function inline cpmScore() {
+ expression: myValue * mySlice(query(myTensor))
+ }
+
+ function inline myValue() {
+ expression: 4
+ }
+
+ function inline mySlice(myTensor) {
+ expression: myTensor{"NULL"}
+ }
+ }
+
+} \ No newline at end of file
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SliceTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SliceTestCase.java
new file mode 100644
index 00000000000..e6c7efd7052
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SliceTestCase.java
@@ -0,0 +1,27 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.derived;
+
+import com.yahoo.component.ComponentId;
+import com.yahoo.search.Query;
+import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
+import com.yahoo.search.query.profile.config.QueryProfileConfigurer;
+import com.yahoo.searchdefinition.parser.ParseException;
+import com.yahoo.vespa.model.container.search.QueryProfiles;
+import org.junit.Test;
+
+import java.io.IOException;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author bratseth
+ */
+public class SliceTestCase extends AbstractExportingTestCase {
+
+ @Test
+ public void testSlice() throws IOException, ParseException {
+ ComponentId.resetGlobalCountersForTests();
+ DerivedConfiguration c = assertCorrectDeriving("slice");
+ }
+
+}