summaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java/com/yahoo/searchdefinition/derived
diff options
context:
space:
mode:
Diffstat (limited to 'config-model/src/test/java/com/yahoo/searchdefinition/derived')
-rw-r--r--config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java28
-rwxr-xr-xconfig-model/src/test/java/com/yahoo/searchdefinition/derived/TokenizationTestCase.java19
2 files changed, 47 insertions, 0 deletions
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
index bfc738a4f87..ef7da4f23d0 100644
--- a/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/SummaryTestCase.java
@@ -6,6 +6,7 @@ import com.yahoo.searchdefinition.Search;
import com.yahoo.searchdefinition.SearchBuilder;
import com.yahoo.searchdefinition.SchemaTestCase;
import com.yahoo.searchdefinition.parser.ParseException;
+import com.yahoo.vespa.config.search.SummaryConfig;
import org.junit.Test;
import java.io.IOException;
@@ -14,6 +15,7 @@ import java.util.Iterator;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
/**
* Tests summary extraction
@@ -151,4 +153,30 @@ public class SummaryTestCase extends SchemaTestCase {
return builder.getSearch("ad");
}
+ @Test
+ public void omit_summary_features_specified_for_document_summary() throws ParseException {
+ String sd = joinLines(
+ "schema test {",
+ " document test {",
+ " field foo type string { indexing: summary }",
+ " }",
+ " document-summary bar {",
+ " summary foo type string {}",
+ " omit-summary-features",
+ " }",
+ " document-summary baz {",
+ " summary foo type string {}",
+ " }",
+ "}");
+ var search = SearchBuilder.createFromString(sd).getSearch();
+ assertOmitSummaryFeatures(true, search, "bar");
+ assertOmitSummaryFeatures(false, search, "baz");
+ }
+
+ private void assertOmitSummaryFeatures(boolean expected, Search search, String summaryName) {
+ var summary = new SummaryClass(search, search.getSummary(summaryName), new BaseDeployLogger());
+ var config = new SummaryConfig.Classes(summary.getSummaryClassConfig());
+ assertEquals(expected, config.omitsummaryfeatures());
+ }
+
}
diff --git a/config-model/src/test/java/com/yahoo/searchdefinition/derived/TokenizationTestCase.java b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TokenizationTestCase.java
new file mode 100755
index 00000000000..6fe367ef6d1
--- /dev/null
+++ b/config-model/src/test/java/com/yahoo/searchdefinition/derived/TokenizationTestCase.java
@@ -0,0 +1,19 @@
+// Copyright Verizon media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.searchdefinition.derived;
+
+import com.yahoo.searchdefinition.parser.ParseException;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * @author bratseh
+ */
+public class TokenizationTestCase extends AbstractExportingTestCase {
+
+ @Test
+ public void testTokenizationScripts() throws IOException, ParseException {
+ assertCorrectDeriving("tokenization");
+ }
+
+}