summaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/prelude
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2022-01-11 18:45:55 +0100
committerJon Bratseth <bratseth@gmail.com>2022-01-11 18:45:55 +0100
commit2627f74bff87b619393cf74fe36228c9cb5ad4ed (patch)
treebdc8ccd44553f9b2fb26cac06286fdbc24a27323 /container-search/src/test/java/com/yahoo/prelude
parent77f8677d12f3cc3013e3c1cca9469e05abf9edae (diff)
Propagate the original term in the evaluation
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/semantics/test/MusicTestCase.java19
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/semantics/test/rulebases/music.sr19
2 files changed, 38 insertions, 0 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/semantics/test/MusicTestCase.java b/container-search/src/test/java/com/yahoo/prelude/semantics/test/MusicTestCase.java
new file mode 100644
index 00000000000..006dcb3c714
--- /dev/null
+++ b/container-search/src/test/java/com/yahoo/prelude/semantics/test/MusicTestCase.java
@@ -0,0 +1,19 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.prelude.semantics.test;
+
+import org.junit.Test;
+
+/**
+ * Tests the rewriting in the semanticsearcher system test
+ *
+ * @author bratseth
+ */
+public class MusicTestCase {
+
+ @Test
+ public void testMusic() {
+ var tester = new RuleBaseTester("music.sr");
+ tester.assertSemantics("AND song:together artist:youngbloods", "together by youngbloods");
+ }
+
+}
diff --git a/container-search/src/test/java/com/yahoo/prelude/semantics/test/rulebases/music.sr b/container-search/src/test/java/com/yahoo/prelude/semantics/test/rulebases/music.sr
new file mode 100644
index 00000000000..5166a8b8e5d
--- /dev/null
+++ b/container-search/src/test/java/com/yahoo/prelude/semantics/test/rulebases/music.sr
@@ -0,0 +1,19 @@
+## Some test rules
+
+# Spelling correction
+bahc -> bach;
+
+# Stopwords
+somelongstopword -> ;
+[stopword] -> ;
+[stopword] :- someotherlongstopword, yetanotherstopword;
+
+#
+[song] by [artist] -> song:[song] artist:[artist];
+
+[song] :- together, imagine, tinseltown;
+[artist] :- youngbloods, beatles, zappa;
+
+# Negative
+various +> -kingz;
+