aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/test/java')
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java4
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java63
-rw-r--r--container-search/src/test/java/com/yahoo/prelude/fastsearch/test/PartialFillTestCase.java19
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java9
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java32
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/MockInvoker.java2
-rw-r--r--container-search/src/test/java/com/yahoo/search/dispatch/rpc/RpcSearchInvokerTest.java5
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingSearcherTestCase.java5
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java32
9 files changed, 68 insertions, 103 deletions
diff --git a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
index 8d4e3364ce4..affa6161440 100644
--- a/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java
@@ -206,12 +206,12 @@ public class ClusterSearcherTestCase {
}
@Override
- protected com.yahoo.search.Result doSearch2(Query query, Execution execution) {
+ protected com.yahoo.search.Result doSearch2(String schema, Query query) {
return null; // search() is overriden, this should never be called
}
@Override
- public com.yahoo.search.Result search(Query query, Execution execution) {
+ public com.yahoo.search.Result search(String schema, Query query) {
com.yahoo.search.Result result = new com.yahoo.search.Result(query);
List<Hit> hits = getHits(query);
if (hits != null) {
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
index 20d2a304c3c..8270700a66b 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/FastSearcherTestCase.java
@@ -1,7 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.prelude.fastsearch.test;
-import com.yahoo.component.chain.Chain;
import com.yahoo.container.QrSearchersConfig;
import com.yahoo.container.handler.VipStatus;
import com.yahoo.container.protect.Error;
@@ -9,9 +8,9 @@ import com.yahoo.prelude.fastsearch.ClusterParams;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.prelude.fastsearch.FastSearcher;
import com.yahoo.prelude.fastsearch.SummaryParameters;
+import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
-import com.yahoo.search.Searcher;
import com.yahoo.search.dispatch.MockDispatcher;
import com.yahoo.search.dispatch.rpc.RpcResourcePool;
import com.yahoo.search.dispatch.searchcluster.Node;
@@ -24,10 +23,8 @@ import com.yahoo.search.schema.DocumentSummary;
import com.yahoo.search.schema.RankProfile;
import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
-import com.yahoo.search.searchchain.Execution;
import org.junit.jupiter.api.Test;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
@@ -42,16 +39,18 @@ import static org.junit.jupiter.api.Assertions.*;
* @author bratseth
*/
public class FastSearcherTestCase {
+ private static final String SCHEMA = "test";
+ private static final String CLUSTER = "test";
@Test
void testNullQuery() {
Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(Collections.emptyList()),
+ MockDispatcher.create(List.of()),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ documentdbInfoConfig(SCHEMA),
+ schemaInfo(SCHEMA));
String query = "?junkparam=ignored";
Result result = doSearch(fastSearcher, new Query(query), 0, 10);
@@ -63,30 +62,20 @@ public class FastSearcherTestCase {
assertEquals(Error.NULL_QUERY.code, message.getCode());
}
- private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain) {
- List<Searcher> searchers = new ArrayList<>();
- searchers.add(topOfChain);
- return new Chain<>(searchers);
- }
-
- private Result doSearch(Searcher searcher, Query query, int offset, int hits) {
+ private Result doSearch(VespaBackEndSearcher searcher, Query query, int offset, int hits) {
query.setOffset(offset);
query.setHits(hits);
- return createExecution(searcher).search(query);
- }
-
- private Execution createExecution(Searcher searcher) {
- return new Execution(chainedAsSearchChain(searcher), Execution.Context.createContextStub());
+ return searcher.search(SCHEMA, query);
}
@Test
void testSinglePassGroupingIsForcedWithSingleNodeGroups() {
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(List.of(new Node("test", 0, "host0", 0))),
+ MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ documentdbInfoConfig(SCHEMA),
+ schemaInfo(SCHEMA));
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -98,18 +87,18 @@ public class FastSearcherTestCase {
request2.setRootOperation(all);
assertForceSinglePassIs(false, q);
- fastSearcher.search(q, new Execution(Execution.Context.createContextStub()));
+ fastSearcher.search(SCHEMA, q);
assertForceSinglePassIs(true, q);
}
@Test
void testRankProfileValidation() {
FastSearcher fastSearcher = new FastSearcher("container.0",
- MockDispatcher.create(List.of(new Node("test", 0, "host0", 0))),
+ MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0))),
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ documentdbInfoConfig(SCHEMA),
+ schemaInfo(SCHEMA));
assertFalse(searchError("?query=q", fastSearcher).contains("does not contain requested rank profile"));
assertFalse(searchError("?query=q&ranking.profile=default", fastSearcher).contains("does not contain requested rank profile"));
assertTrue(searchError("?query=q&ranking.profile=nosuch", fastSearcher).contains("does not contain requested rank profile"));
@@ -117,14 +106,14 @@ public class FastSearcherTestCase {
@Test
void testSummaryNeedsQuery() {
- var documentDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("test")));
- var schema = new Schema.Builder("test")
+ var documentDb = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name(SCHEMA)));
+ var schema = new Schema.Builder(SCHEMA)
.add(new DocumentSummary.Builder("default").build())
.add(new RankProfile.Builder("default").setHasRankFeatures(false)
.setHasSummaryFeatures(false)
.build());
FastSearcher backend = new FastSearcher("container.0",
- MockDispatcher.create(Collections.singletonList(new Node("test", 0, "host0", 0))),
+ MockDispatcher.create(Collections.singletonList(new Node(CLUSTER, 0, "host0", 0))),
new SummaryParameters(null),
new ClusterParams("testhittype"),
documentDb,
@@ -141,14 +130,14 @@ public class FastSearcherTestCase {
@Test
void testSinglePassGroupingIsNotForcedWithSingleNodeGroups() {
- MockDispatcher dispatcher = MockDispatcher.create(List.of(new Node("test", 0, "host0", 0), new Node("test", 2, "host1", 0)));
+ MockDispatcher dispatcher = MockDispatcher.create(List.of(new Node(CLUSTER, 0, "host0", 0), new Node(CLUSTER, 2, "host1", 0)));
FastSearcher fastSearcher = new FastSearcher("container.0",
dispatcher,
new SummaryParameters(null),
new ClusterParams("testhittype"),
- documentdbInfoConfig("test"),
- schemaInfo("test"));
+ documentdbInfoConfig(SCHEMA),
+ schemaInfo(SCHEMA));
Query q = new Query("?query=foo");
GroupingRequest request1 = GroupingRequest.newInstance(q);
request1.setRootOperation(new AllOperation());
@@ -160,7 +149,7 @@ public class FastSearcherTestCase {
request2.setRootOperation(all);
assertForceSinglePassIs(false, q);
- fastSearcher.search(q, new Execution(Execution.Context.createContextStub()));
+ fastSearcher.search(SCHEMA, q);
assertForceSinglePassIs(false, q);
}
@@ -183,7 +172,7 @@ public class FastSearcherTestCase {
searchClusterB.name(clusterName);
b.searchcluster(searchClusterB);
VipStatus vipStatus = new VipStatus(b.build());
- List<Node> nodes_1 = List.of(new Node("test", 0, "host0", 0));
+ List<Node> nodes_1 = List.of(new Node(CLUSTER, 0, "host0", 0));
RpcResourcePool rpcPool_1 = new RpcResourcePool(MockDispatcher.toDispatchConfig(), MockDispatcher.toNodesConfig(nodes_1));
MockDispatcher dispatch_1 = MockDispatcher.create(nodes_1, rpcPool_1, vipStatus);
dispatch_1.clusterMonitor.shutdown();
@@ -193,12 +182,12 @@ public class FastSearcherTestCase {
assertTrue(vipStatus.isInRotation()); //Verify that deconstruct does not touch vipstatus
}
- private String searchError(String query, Searcher searcher) {
+ private String searchError(String query, VespaBackEndSearcher searcher) {
return search(query, searcher).hits().getError().getDetailedMessage();
}
- private Result search(String query, Searcher searcher) {
- return searcher.search(new Query(query), new Execution(Execution.Context.createContextStub()));
+ private Result search(String query, VespaBackEndSearcher searcher) {
+ return searcher.search(SCHEMA, new Query(query));
}
private DocumentdbInfoConfig documentdbInfoConfig(String schemaName) {
diff --git a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/PartialFillTestCase.java b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/PartialFillTestCase.java
index 27a27e993a8..a033ccdace6 100644
--- a/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/PartialFillTestCase.java
+++ b/container-search/src/test/java/com/yahoo/prelude/fastsearch/test/PartialFillTestCase.java
@@ -2,16 +2,13 @@
package com.yahoo.prelude.fastsearch.test;
import com.yahoo.component.chain.Chain;
-import com.yahoo.language.simple.SimpleLinguistics;
import com.yahoo.prelude.fastsearch.FastHit;
import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
-import com.yahoo.search.rendering.RendererRegistry;
import com.yahoo.search.result.ErrorHit;
import com.yahoo.search.result.ErrorMessage;
-import com.yahoo.search.searchchain.Execution;
import org.junit.jupiter.api.Test;
import java.util.ArrayList;
@@ -27,7 +24,7 @@ public class PartialFillTestCase {
public static class FS4 extends VespaBackEndSearcher {
public List<Result> history = new ArrayList<>();
- protected Result doSearch2(Query query, Execution execution) {
+ protected Result doSearch2(String schema, Query query) {
return new Result(query);
}
protected void doPartialFill(Result result, String summaryClass) {
@@ -36,7 +33,7 @@ public class PartialFillTestCase {
}
public static class BadFS4 extends VespaBackEndSearcher {
- protected Result doSearch2(Query query, Execution execution) {
+ protected Result doSearch2(String schema, Query query) {
return new Result(query);
}
protected void doPartialFill(Result result, String summaryClass) {
@@ -130,24 +127,18 @@ public class PartialFillTestCase {
com.yahoo.search.result.ErrorMessage error = i.next();
switch (n) {
case 0:
- assertEquals(exp_sub, error);
- break;
case 1:
assertEquals(exp_sub, error);
break;
default:
- assertTrue(false);
+ fail();
}
n++;
}
}
- private Execution createExecution(Searcher searcher) {
- return new Execution(chainedAsSearchChain(searcher), Execution.Context.createContextStub());
- }
-
- private void doFill(Searcher searcher, Result result, String summaryClass) {
- createExecution(searcher).fill(result, summaryClass);
+ private void doFill(VespaBackEndSearcher searcher, Result result, String summaryClass) {
+ searcher.fill(result, summaryClass);
}
private Chain<Searcher> chainedAsSearchChain(Searcher topOfChain) {
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
index 8dc74110291..23846db3f0b 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/DispatcherTest.java
@@ -18,7 +18,6 @@ import com.yahoo.search.dispatch.searchcluster.Pinger;
import com.yahoo.search.dispatch.searchcluster.PongHandler;
import com.yahoo.search.dispatch.searchcluster.SearchCluster;
import com.yahoo.search.dispatch.searchcluster.SearchGroups;
-import com.yahoo.search.searchchain.Execution;
import com.yahoo.vespa.config.search.DispatchConfig;
import com.yahoo.vespa.config.search.DispatchNodesConfig;
import com.yahoo.yolean.UncheckedInterruptedException;
@@ -243,7 +242,7 @@ public class DispatcherTest {
rpcPool.getConnection(node.key()).request(null, null, 0, null, null, 0);
return null;
};
- @Override protected InvokerResult getSearchResult(Execution execution) {
+ @Override protected InvokerResult getSearchResult() {
return new InvokerResult(new Result(new Query()));
}
@Override protected void release() { }
@@ -288,11 +287,11 @@ public class DispatcherTest {
// Start some searches, one against each group, since we have a round-robin policy.
SearchInvoker search0 = dispatcher.getSearchInvoker(new Query(), null);
- search0.search(new Query(), null);
+ search0.search(new Query());
// Unknown whether the first or second search hits node0, so we must track that.
int offset = nodeIdOfSearcher0.get();
SearchInvoker search1 = dispatcher.getSearchInvoker(new Query(), null);
- search1.search(new Query(), null);
+ search1.search(new Query());
// Wait for the current cluster monitor to be mid-ping-round.
doPing.set(true);
@@ -330,7 +329,7 @@ public class DispatcherTest {
// Next search should hit group0 again, this time on node2.
SearchInvoker search2 = dispatcher.getSearchInvoker(new Query(), null);
- search2.search(new Query(), null);
+ search2.search(new Query());
// Searches against nodes 1 and 2 complete.
(offset == 0 ? search0 : search1).close();
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
index fac75b1dd68..8ced7d3895e 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/InterleavedSearchInvokerTest.java
@@ -61,7 +61,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(4900, 100, 1));
expectedEvents.add(new Event(4800, 100, 2));
- invoker.search(query, null);
+ invoker.search(query);
assertTrue(expectedEvents.isEmpty(), "All test scenario events processed");
}
@@ -75,7 +75,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(4700, 300, 1));
expectedEvents.add(null);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertTrue(expectedEvents.isEmpty(), "All test scenario events processed");
assertNull(result.hits().getErrorHit(), "Result is not marked as an error");
@@ -94,7 +94,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(2400, 100, 2));
expectedEvents.add(new Event(0, 0, null));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertTrue(expectedEvents.isEmpty(), "All test scenario events processed");
assertNull(result.hits().getErrorHit(), "Result is not marked as an error");
@@ -113,7 +113,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(null, 100, 0));
expectedEvents.add(new Event(null, 200, 1));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
Coverage cov = result.getCoverage(true);
assertEquals(100000L, cov.getDocs());
@@ -134,7 +134,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(null, 100, 0));
expectedEvents.add(new Event(null, 200, 1));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
Coverage cov = result.getCoverage(true);
assertEquals(23420L, cov.getDocs());
@@ -156,7 +156,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(null, 100, 0));
expectedEvents.add(new Event(null, 200, 1));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
Coverage cov = result.getCoverage(true);
assertEquals(9900L, cov.getDocs());
@@ -178,7 +178,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(null, 100, 0));
expectedEvents.add(null);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
Coverage cov = result.getCoverage(true);
assertEquals(50155L, cov.getDocs());
@@ -213,7 +213,7 @@ public class InterleavedSearchInvokerTest {
query.setHits(8);
query.properties().set(Dispatcher.topKProbability, topKProbability);
SearchInvoker[] invokers = invoker.invokers().toArray(new SearchInvoker[0]);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(2, invokers.length);
assertEquals(expectedK, ((MockInvoker) invokers[0]).hitsRequested);
assertEquals(8, result.hits().size());
@@ -264,7 +264,7 @@ public class InterleavedSearchInvokerTest {
void requireThatMergeOfConcreteHitsObeySorting() throws IOException {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(A5, B5, new Group(0, List.of()))) {
query.setHits(12);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(10, result.hits().size());
assertEquals(11.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(1.0, result.hits().get(9).getRelevance().getScore(), DELTA);
@@ -273,7 +273,7 @@ public class InterleavedSearchInvokerTest {
}
try ( InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(B5, A5, new Group(0, List.of()))) {
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(10, result.hits().size());
assertEquals(11.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(1.0, result.hits().get(9).getRelevance().getScore(), DELTA);
@@ -287,7 +287,7 @@ public class InterleavedSearchInvokerTest {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(A5, B5, new Group(0, List.of()))) {
query.setHits(3);
query.setOffset(5);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(3, result.hits().size());
assertEquals(7.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(3.0, result.hits().get(2).getRelevance().getScore(), DELTA);
@@ -297,7 +297,7 @@ public class InterleavedSearchInvokerTest {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(B5, A5, new Group(0, List.of()))) {
query.setOffset(5);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(3, result.hits().size());
assertEquals(7.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(3.0, result.hits().get(2).getRelevance().getScore(), DELTA);
@@ -311,7 +311,7 @@ public class InterleavedSearchInvokerTest {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(A5Aux, B5Aux, new Group(0, List.of()))) {
query.setHits(3);
query.setOffset(5);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(7, result.hits().size());
assertEquals(7.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(3.0, result.hits().get(2).getRelevance().getScore(), DELTA);
@@ -322,7 +322,7 @@ public class InterleavedSearchInvokerTest {
try (InterleavedSearchInvoker invoker = createInterLeavedTestInvoker(B5Aux, A5Aux, new Group(0, List.of()))) {
query.setOffset(5);
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(7, result.hits().size());
assertEquals(7.0, result.hits().get(0).getRelevance().getScore(), DELTA);
assertEquals(3.0, result.hits().get(2).getRelevance().getScore(), DELTA);
@@ -359,7 +359,7 @@ public class InterleavedSearchInvokerTest {
try (InterleavedSearchInvoker invoker = new InterleavedSearchInvoker(Timer.monotonic, invokers, hitEstimator, dispatchConfig, new Group(0, List.of()), Collections.emptySet())) {
invoker.responseAvailable(invokers.get(0));
invoker.responseAvailable(invokers.get(1));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
assertEquals(1, ((GroupingListHit) result.hits().get(0)).getGroupingList().size());
}
for (SearchInvoker invoker : invokers) {
@@ -404,7 +404,7 @@ public class InterleavedSearchInvokerTest {
expectedEvents.add(new Event(null, 1, 1));
expectedEvents.add(new Event(null, 100, 0));
- Result result = invoker.search(query, null);
+ Result result = invoker.search(query);
Coverage cov = result.getCoverage(true);
assertEquals(50155L, cov.getDocs());
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/MockInvoker.java b/container-search/src/test/java/com/yahoo/search/dispatch/MockInvoker.java
index a1521a88fb7..e43f3b0bd9a 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/MockInvoker.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/MockInvoker.java
@@ -40,7 +40,7 @@ class MockInvoker extends SearchInvoker {
}
@Override
- protected InvokerResult getSearchResult(Execution execution) {
+ protected InvokerResult getSearchResult() {
InvokerResult ret = new InvokerResult(query, 10);
if (coverage != null) {
ret.getResult().setCoverage(coverage);
diff --git a/container-search/src/test/java/com/yahoo/search/dispatch/rpc/RpcSearchInvokerTest.java b/container-search/src/test/java/com/yahoo/search/dispatch/rpc/RpcSearchInvokerTest.java
index 3f527f34f31..2600d8612f8 100644
--- a/container-search/src/test/java/com/yahoo/search/dispatch/rpc/RpcSearchInvokerTest.java
+++ b/container-search/src/test/java/com/yahoo/search/dispatch/rpc/RpcSearchInvokerTest.java
@@ -9,7 +9,6 @@ import com.yahoo.prelude.fastsearch.VespaBackEndSearcher;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.dispatch.searchcluster.Node;
-import com.yahoo.search.searchchain.Execution;
import org.junit.jupiter.api.Test;
import java.io.IOException;
@@ -45,7 +44,7 @@ public class RpcSearchInvokerTest {
assertEquals(10, request.getHits());
assertEquals(3, request.getOffset());
- assertTrue(request.getQueryTreeBlob().size() > 0);
+ assertFalse(request.getQueryTreeBlob().isEmpty());
var invoker2 = new RpcSearchInvoker(mockSearcher(), compressor, new Node("test", 8, "eight", 1), mockPool, 1000);
RpcSearchInvoker.RpcContext context2 = (RpcSearchInvoker.RpcContext) invoker2.sendSearchRequest(q, context);
@@ -121,7 +120,7 @@ public class RpcSearchInvokerTest {
private VespaBackEndSearcher mockSearcher() {
return new VespaBackEndSearcher() {
@Override
- protected Result doSearch2(Query query, Execution execution) {
+ protected Result doSearch2(String schema, Query query) {
fail("Unexpected call");
return null;
}
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingSearcherTestCase.java
index 3d9a958c757..c7e95f802ab 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingSearcherTestCase.java
@@ -16,7 +16,6 @@ import com.yahoo.search.Result;
import com.yahoo.search.result.Hit;
import com.yahoo.search.schema.Schema;
import com.yahoo.search.schema.SchemaInfo;
-import com.yahoo.search.searchchain.Execution;
import com.yahoo.searchlib.aggregation.Grouping;
import com.yahoo.vdslib.DocumentSummary;
import com.yahoo.vdslib.SearchResult;
@@ -161,9 +160,7 @@ public class StreamingSearcherTestCase {
}
private static Result executeQuery(StreamingSearcher searcher, Query query) {
- Execution execution = new Execution(Execution.Context.createContextStub());
- query.getModel().setRestrict("test");
- return searcher.doSearch2(query, execution);
+ return searcher.doSearch2("test", query);
}
private static Query[] generateTestQueries(String queryString) {
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
index 8be60b7c3b0..30fb33ee8c8 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/StreamingVisitorTest.java
@@ -23,6 +23,7 @@ import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import static org.junit.jupiter.api.Assertions.*;
@@ -76,7 +77,7 @@ public class StreamingVisitorTest {
};
}
- private class QueryArguments {
+ private static class QueryArguments {
// General query parameters
String query = "test";
double timeout = 0.5;
@@ -188,25 +189,21 @@ public class StreamingVisitorTest {
return query;
}
- private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, String docType, Route route) {
+ private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, String schema, Route route) {
//System.out.println("params="+params);
// Verify parameters based on properties
if (qa.userId != null) {
- assertEquals(docType + " and ( id.user=="+qa.userId + " )", params.getDocumentSelection());
+ assertEquals(schema + " and ( id.user=="+qa.userId + " )", params.getDocumentSelection());
} else if (qa.groupName != null) {
- assertEquals(docType + " and ( id.group==\""+qa.groupName+"\" )", params.getDocumentSelection());
+ assertEquals(schema + " and ( id.group==\""+qa.groupName+"\" )", params.getDocumentSelection());
} else if ((qa.selection == null) || qa.selection.isEmpty()) {
- assertEquals(docType, params.getDocumentSelection());
+ assertEquals(schema, params.getDocumentSelection());
} else {
- assertEquals(docType + " and ( " + qa.selection + " )", params.getDocumentSelection());
+ assertEquals(schema + " and ( " + qa.selection + " )", params.getDocumentSelection());
}
assertEquals(qa.from, params.getFromTimestamp());
assertEquals(qa.to, params.getToTimestamp());
- if (qa.priority != null) {
- assertEquals(qa.priority, params.getPriority());
- } else {
- assertEquals(DocumentProtocol.Priority.VERY_HIGH, params.getPriority());
- }
+ assertEquals(Objects.requireNonNullElse(qa.priority, DocumentProtocol.Priority.VERY_HIGH), params.getPriority());
if (qa.maxBucketsPerVisitor != 0) {
assertEquals(qa.maxBucketsPerVisitor, params.getMaxBucketsPerVisitor());
} else {
@@ -227,17 +224,10 @@ public class StreamingVisitorTest {
//System.err.println("query="+new String(params.getLibraryParameters().get("querystackcount")));
assertNotNull(params.getLibraryParameters().get("querystackcount")); // TODO: Check contents
assertEquals(searchCluster, new String(params.getLibraryParameters().get("searchcluster")));
- if (qa.summary != null) {
- assertEquals(qa.summary, new String(params.getLibraryParameters().get("summaryclass")));
- } else {
- assertEquals("default", new String(params.getLibraryParameters().get("summaryclass")));
- }
+ assertEquals(schema, new String(params.getLibraryParameters().get("schema")));
+ assertEquals(Objects.requireNonNullElse(qa.summary, "default"), new String(params.getLibraryParameters().get("summaryclass")));
assertEquals(Integer.toString(qa.offset+qa.hits), new String(params.getLibraryParameters().get("summarycount")));
- if (qa.profile != null) {
- assertEquals(qa.profile, new String(params.getLibraryParameters().get("rankprofile")));
- } else {
- assertEquals("default", new String(params.getLibraryParameters().get("rankprofile")));
- }
+ assertEquals(Objects.requireNonNullElse(qa.profile, "default"), new String(params.getLibraryParameters().get("rankprofile")));
//System.err.println("queryflags="+new String(params.getLibraryParameters().get("queryflags")));
assertNotNull(params.getLibraryParameters().get("queryflags")); // TODO: Check contents
if (qa.location != null) {