aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/search/grouping/result
diff options
context:
space:
mode:
authorbjormel <bjormel@yahooinc.com>2023-10-26 13:59:28 +0000
committerbjormel <bjormel@yahooinc.com>2023-10-26 13:59:28 +0000
commit567be9a1f6353cec41c23bfd1fcd46b4b2a4d2d7 (patch)
tree4664a743e166a5e11aee7b9acd70ad8ee2617612 /container-search/src/test/java/com/yahoo/search/grouping/result
parente9058b555d4dfea2f6c872d9a677e8678b569569 (diff)
parentbce3b8e926bf9da880172acbe1ba4b12d5e026d6 (diff)
Merge branch 'master' into bjormel/aws-main-controllerbjormel/aws-main-controller
Diffstat (limited to 'container-search/src/test/java/com/yahoo/search/grouping/result')
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java31
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java2
6 files changed, 31 insertions, 10 deletions
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
index 3e1cff54737..7ec35151eab 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/FlatteningSearcherTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.component.ComponentId;
@@ -12,6 +12,9 @@ import com.yahoo.search.Searcher;
import com.yahoo.search.grouping.GroupingRequest;
import com.yahoo.search.grouping.request.GroupingOperation;
import com.yahoo.search.grouping.vespa.GroupingExecutor;
+import com.yahoo.search.result.DefaultErrorHit;
+import com.yahoo.search.result.ErrorHit;
+import com.yahoo.search.result.ErrorMessage;
import com.yahoo.search.result.Hit;
import com.yahoo.search.result.HitGroup;
import com.yahoo.search.searchchain.Execution;
@@ -72,18 +75,21 @@ public class FlatteningSearcherTestCase {
));
Execution execution = newExecution(new FlatteningSearcher(),
new GroupingExecutor(ComponentId.fromString("grouping")),
- new ResultProvider(Arrays.asList(
+ new ResultProvider(List.of(
new GroupingListHit(List.of(group0), null),
- new GroupingListHit(List.of(group1), null))));
+ new GroupingListHit(List.of(group1), null))),
+ new HitsProvider(List.of(
+ new DefaultErrorHit("source 1", ErrorMessage.createBackendCommunicationError("backend communication error 1")),
+ new DefaultErrorHit("source 2", ErrorMessage.createBackendCommunicationError("backend communication error 1")))));
Result result = execution.search(query);
- assertEquals(5, result.hits().size());
+ assertEquals(6, result.hits().size());
assertFlat(result);
assertEquals(2, result.getTotalHitCount());
}
private void assertFlat(Result result) {
for (var hit : result.hits())
- assertTrue(hit instanceof FastHit);
+ assertTrue(hit instanceof FastHit || hit instanceof ErrorHit);
}
private FS4Hit fs4Hit(double relevance) {
@@ -126,5 +132,20 @@ public class FlatteningSearcherTestCase {
return result;
}
}
+ @After (GroupingExecutor.COMPONENT_NAME)
+ private static class HitsProvider extends Searcher {
+ private final List<Hit> hits;
+ HitsProvider(List<Hit> hits) {
+ this.hits = hits;
+ }
+ @Override
+ public Result search(Query query, Execution exec) {
+ Result result = exec.search(query);
+ for (Hit hit : hits) {
+ result.hits().add(hit);
+ }
+ return result;
+ }
+ }
}
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
index 0443f507848..fcab6430a8a 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupIdTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.prelude.hitfield.RawBase64;
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
index 3c583c88d5a..13b25e7e0bb 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupListTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.search.grouping.Continuation;
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
index 4e359531b7a..27eb3570d30 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/GroupTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.search.result.Hit;
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
index 5f1d2d3f125..d1be2948a90 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/HitListTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.search.grouping.Continuation;
diff --git a/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java b/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
index 69bd848ebcd..64d238632e4 100644
--- a/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
+++ b/container-search/src/test/java/com/yahoo/search/grouping/result/HitRendererTestCase.java
@@ -1,4 +1,4 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.result;
import com.yahoo.search.grouping.Continuation;