aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/test/java/com/yahoo/vespa
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2018-10-05 18:05:32 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2018-10-05 18:05:32 +0200
commit0de5e52ca438a9f55ed361e75b2e02fc9f525443 (patch)
tree7bfc847ef336e0356c87c5c45358b3349fccbf05 /container-search/src/test/java/com/yahoo/vespa
parentff6fc885e081eb0d8bbfd7ffd57cdfbe95a6300f (diff)
Limit document selection per cluster by the document type of the cluster.
Diffstat (limited to 'container-search/src/test/java/com/yahoo/vespa')
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java28
-rw-r--r--container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsVisitorTestCase.java14
2 files changed, 25 insertions, 17 deletions
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
index c8c653d67ed..0d58b10fde4 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsStreamingSearcherTestCase.java
@@ -4,12 +4,14 @@ package com.yahoo.vespa.streamingvisitors;
import com.yahoo.config.subscription.ConfigGetter;
import com.yahoo.document.select.parser.TokenMgrException;
import com.yahoo.messagebus.routing.Route;
+import com.yahoo.prelude.fastsearch.CacheKey;
+import com.yahoo.prelude.fastsearch.CacheParams;
+import com.yahoo.prelude.fastsearch.ClusterParams;
import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig;
import com.yahoo.document.select.parser.ParseException;
import com.yahoo.fs4.QueryPacket;
-import com.yahoo.prelude.Ping;
-import com.yahoo.prelude.Pong;
-import com.yahoo.prelude.fastsearch.*;
+import com.yahoo.prelude.fastsearch.SummaryParameters;
+import com.yahoo.prelude.fastsearch.TimeoutException;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.result.Hit;
@@ -25,7 +27,11 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
/**
* @author <a href="mailto:ulf@yahoo-inc.com">Ulf Carlin</a>
@@ -35,18 +41,20 @@ public class VdsStreamingSearcherTestCase {
public static final String GROUPDOC_ID_PREFIX = "groupdoc:namespace:group1:userspecific";
private static class MockVisitor implements Visitor {
- private Query query;
- String searchCluster;
- Route route;
+ private final Query query;
+ final String searchCluster;
+ final Route route;
+ final String documentType;
int totalHitCount;
private final List<SearchResult.Hit> hits = new ArrayList<>();
private final Map<String, DocumentSummary.Summary> summaryMap = new HashMap<>();
private final List<Grouping> groupings = new ArrayList<>();
- MockVisitor(Query query, String searchCluster, Route route) {
+ MockVisitor(Query query, String searchCluster, Route route, String documentType) {
this.query = query;
this.searchCluster = searchCluster;
this.route = route;
+ this.documentType = documentType;
}
@Override
@@ -124,8 +132,8 @@ public class VdsStreamingSearcherTestCase {
private static class MockVisitorFactory implements VisitorFactory {
@Override
- public Visitor createVisitor(Query query, String searchCluster, Route route) {
- return new MockVisitor(query, searchCluster, route);
+ public Visitor createVisitor(Query query, String searchCluster, Route route, String documentType) {
+ return new MockVisitor(query, searchCluster, route, documentType);
}
}
diff --git a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsVisitorTestCase.java b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsVisitorTestCase.java
index 6964fd3b5e8..c84088a19bb 100644
--- a/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsVisitorTestCase.java
+++ b/container-search/src/test/java/com/yahoo/vespa/streamingvisitors/VdsVisitorTestCase.java
@@ -224,15 +224,15 @@ public class VdsVisitorTestCase {
return query;
}
- private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, Route route) {
+ private void verifyVisitorParameters(VisitorParameters params, QueryArguments qa, String searchCluster, String docType, Route route) {
//System.out.println("params="+params);
// Verify parameters based on properties
if (qa.userId != null) {
- assertEquals("id.user=="+qa.userId, params.getDocumentSelection());
+ assertEquals(docType + " and id.user=="+qa.userId, params.getDocumentSelection());
} else if (qa.groupName != null) {
- assertEquals("id.group==\""+qa.groupName+"\"", params.getDocumentSelection());
+ assertEquals(docType + " and id.group==\""+qa.groupName+"\"", params.getDocumentSelection());
} else if (qa.selection != null) {
- assertEquals(qa.selection, params.getDocumentSelection());
+ assertEquals(docType + " and " +qa.selection, params.getDocumentSelection());
} else {
assertEquals("", params.getDocumentSelection());
}
@@ -407,15 +407,15 @@ public class VdsVisitorTestCase {
}
private void verifyVisitorOk(MockVisitorSessionFactory factory, QueryArguments qa, Route route, String searchCluster) throws Exception {
- VdsVisitor visitor = new VdsVisitor(buildQuery(qa), searchCluster, route, factory);
+ VdsVisitor visitor = new VdsVisitor(buildQuery(qa), searchCluster, route, "mytype", factory);
visitor.doSearch();
- verifyVisitorParameters(factory.getParams(), qa, searchCluster, route);
+ verifyVisitorParameters(factory.getParams(), qa, searchCluster, "mytype", route);
supplyResults(visitor);
verifyResults(qa, visitor);
}
private void verifyVisitorFails(MockVisitorSessionFactory factory, QueryArguments qa, Route route, String searchCluster) throws Exception {
- VdsVisitor visitor = new VdsVisitor(buildQuery(qa), searchCluster, route, factory);
+ VdsVisitor visitor = new VdsVisitor(buildQuery(qa), searchCluster, route, "mytype", factory);
try {
visitor.doSearch();
assertTrue("Visitor did not fail", false);