summaryrefslogtreecommitdiffstats
path: root/sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java')
-rw-r--r--sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java b/sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java
new file mode 100644
index 00000000000..ea29533081a
--- /dev/null
+++ b/sample-apps/boolean-search/src/test/java/com/yahoo/example/SubqueriesSearcherTest.java
@@ -0,0 +1,37 @@
+package com.yahoo.example;
+
+import com.yahoo.application.Application;
+import com.yahoo.application.Networking;
+import com.yahoo.application.container.Search;
+import com.yahoo.component.ComponentSpecification;
+import com.yahoo.search.Query;
+import com.yahoo.search.Result;
+import com.yahoo.search.result.Hit;
+import org.junit.Test;
+
+import java.nio.file.Paths;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * @author Joe Developer
+ */
+public class SubqueriesSearcherTest {
+ @Test
+ public void hit_is_added() throws Exception {
+ try (Application app = Application.fromApplicationPackage(
+ Paths.get("src/test/application"),
+ Networking.disable))
+ {
+ Search search = app.getJDisc("jdisc").search();
+ Result result = search.process(ComponentSpecification.fromString("default"), new Query("?query=ignored"));
+
+ assertEquals(3, result.hits().size());
+ Hit hit = result.hits().get(0);
+
+ assertEquals(null, hit.getField("summaryfeatures")); // Summaryfeatures was removed by searcher
+ assertEquals(0x100000003L, hit.getField("subqueries(target)"));
+ }
+ }
+
+}