diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-05-02 19:16:56 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-05-02 19:16:56 +0200 |
commit | 74493720a11f573c76c2574a98a7a2f591c20a64 (patch) | |
tree | ff4c2f65b0ff6430147a2d6109bbc6aa2ed0c6ef /container-search/src/test/java/com/yahoo/prelude | |
parent | c8635c55ff8b7a7481c5d1158f7fd04d2f5d09a0 (diff) |
Use SchemaInfo
Diffstat (limited to 'container-search/src/test/java/com/yahoo/prelude')
-rw-r--r-- | container-search/src/test/java/com/yahoo/prelude/cluster/ClusterSearcherTestCase.java | 17 |
1 files changed, 13 insertions, 4 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 801f7da1939..2d62e4c0154 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 @@ -22,6 +22,9 @@ import com.yahoo.search.config.ClusterConfig; import com.yahoo.search.dispatch.Dispatcher; import com.yahoo.search.dispatch.rpc.RpcResourcePool; import com.yahoo.search.result.Hit; +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 com.yahoo.vespa.config.search.DispatchConfig; import org.junit.Test; @@ -81,7 +84,7 @@ public class ClusterSearcherTestCase { } private Set<String> resolve(ClusterSearcher searcher, String query) { - return searcher.resolveDocumentTypes(new Query("?query=hello" + query), createIndexFacts()); + return searcher.resolveSchemas(new Query("?query=hello" + query), createIndexFacts()); } @Test @@ -267,9 +270,15 @@ public class ClusterSearcherTestCase { new MyMockSearcher(expectAttributePrefetch), new InThreadExecutorService()); try { - cluster.setValidRankProfile("default", documentTypes); - cluster.addValidRankProfile("testprofile", "type1"); - return new Execution(cluster, Execution.Context.createContextStub()); + List<Schema> schemas = new ArrayList<>(); + for (String docType : docTypesList) { + var schemaBuilder = new Schema.Builder(docType); + schemaBuilder.add(new RankProfile.Builder("default").build()); + if (docType.equals("type1")) + schemaBuilder.add(new RankProfile.Builder("testprofile").build()); + schemas.add(schemaBuilder.build()); + } + return new Execution(cluster, Execution.Context.createContextStub(new SchemaInfo(schemas, Map.of()))); } finally { cluster.deconstruct(); } |