diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-04-27 13:16:11 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-04-27 13:16:11 +0200 |
commit | 1c38c6e29a59eff80396f4a367245d6694f87168 (patch) | |
tree | 65f613f5b2220c3adbd67a6c741236a697272d84 /container-search/src/main/java | |
parent | 9eddf6d78a3544843842f34a7b711a5565e7fd03 (diff) |
Create schema-info for global schema info
Diffstat (limited to 'container-search/src/main/java')
4 files changed, 16 insertions, 19 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/config/SchemaInfo.java b/container-search/src/main/java/com/yahoo/search/config/SchemaInfo.java index 746f1c340f2..4a8ec83c847 100644 --- a/container-search/src/main/java/com/yahoo/search/config/SchemaInfo.java +++ b/container-search/src/main/java/com/yahoo/search/config/SchemaInfo.java @@ -2,9 +2,8 @@ package com.yahoo.search.config; import com.yahoo.api.annotations.Beta; -import com.yahoo.component.annotation.Inject; import com.yahoo.container.QrSearchersConfig; -import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; +import com.yahoo.container.search.SchemaInfoConfig; import com.yahoo.search.Query; import com.yahoo.tensor.TensorType; @@ -44,11 +43,10 @@ public class SchemaInfo { /** The schemas contained in each content cluster indexed by cluster name */ private final Map<String, List<String>> clusters; - @Inject public SchemaInfo(IndexInfoConfig indexInfo, // will be used in the future - DocumentdbInfoConfig documentdbInfoConfig, + SchemaInfoConfig schemaInfoConfig, QrSearchersConfig qrSearchersConfig) { - this(SchemaInfoConfigurer.toSchemas(documentdbInfoConfig), SchemaInfoConfigurer.toClusters(qrSearchersConfig)); + this(SchemaInfoConfigurer.toSchemas(schemaInfoConfig), SchemaInfoConfigurer.toClusters(qrSearchersConfig)); } public SchemaInfo(List<Schema> schemas, Map<String, List<String>> clusters) { diff --git a/container-search/src/main/java/com/yahoo/search/config/SchemaInfoConfigurer.java b/container-search/src/main/java/com/yahoo/search/config/SchemaInfoConfigurer.java index ae06babda66..49acf589ba3 100644 --- a/container-search/src/main/java/com/yahoo/search/config/SchemaInfoConfigurer.java +++ b/container-search/src/main/java/com/yahoo/search/config/SchemaInfoConfigurer.java @@ -2,11 +2,10 @@ package com.yahoo.search.config; import com.yahoo.container.QrSearchersConfig; -import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; +import com.yahoo.container.search.SchemaInfoConfig; import com.yahoo.tensor.TensorType; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -19,13 +18,13 @@ import java.util.stream.Collectors; */ class SchemaInfoConfigurer { - static List<Schema> toSchemas(DocumentdbInfoConfig documentdbInfoConfig) { - return documentdbInfoConfig.documentdb().stream().map(config -> toSchema(config)).collect(Collectors.toList()); + static List<Schema> toSchemas(SchemaInfoConfig documentdbInfoConfig) { + return documentdbInfoConfig.schema().stream().map(config -> toSchema(config)).collect(Collectors.toList()); } - static Schema toSchema(DocumentdbInfoConfig.Documentdb documentDbConfig) { - Schema.Builder builder = new Schema.Builder(documentDbConfig.name()); - for (var profileConfig : documentDbConfig.rankprofile()) { + static Schema toSchema(SchemaInfoConfig.Schema schemaInfoConfig) { + Schema.Builder builder = new Schema.Builder(schemaInfoConfig.name()); + for (var profileConfig : schemaInfoConfig.rankprofile()) { RankProfile.Builder profileBuilder = new RankProfile.Builder(profileConfig.name()); profileBuilder.setHasSummaryFeatures(profileConfig.hasSummaryFeatures()); profileBuilder.setHasRankFeatures(profileConfig.hasRankFeatures()); diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/Execution.java b/container-search/src/main/java/com/yahoo/search/searchchain/Execution.java index baf9f35c72b..0a4f3e04955 100644 --- a/container-search/src/main/java/com/yahoo/search/searchchain/Execution.java +++ b/container-search/src/main/java/com/yahoo/search/searchchain/Execution.java @@ -140,7 +140,7 @@ public class Execution extends com.yahoo.processing.execution.Execution { public Context(SearchChainRegistry searchChainRegistry, IndexFacts indexFacts, SpecialTokenRegistry tokenRegistry, RendererRegistry rendererRegistry, Linguistics linguistics, Executor executor) { - this(searchChainRegistry, indexFacts, SchemaInfo.empty(), tokenRegistry, rendererRegistry, linguistics, Runnable::run); + this(searchChainRegistry, indexFacts, SchemaInfo.empty(), tokenRegistry, rendererRegistry, linguistics, executor); } /** @deprecated pass an executor */ diff --git a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java index 06814a4c436..4af2b5c9073 100644 --- a/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java +++ b/container-search/src/main/java/com/yahoo/search/searchchain/ExecutionFactory.java @@ -11,12 +11,12 @@ import com.yahoo.component.provider.ComponentRegistry; import com.yahoo.concurrent.ThreadFactoryFactory; import com.yahoo.container.QrSearchersConfig; import com.yahoo.container.core.ChainsConfig; +import com.yahoo.container.search.SchemaInfoConfig; import com.yahoo.language.Linguistics; import com.yahoo.language.simple.SimpleLinguistics; import com.yahoo.prelude.IndexFacts; import com.yahoo.prelude.IndexModel; import com.yahoo.language.process.SpecialTokenRegistry; -import com.yahoo.prelude.fastsearch.DocumentdbInfoConfig; import com.yahoo.processing.rendering.Renderer; import com.yahoo.search.Searcher; import com.yahoo.search.config.IndexInfoConfig; @@ -51,7 +51,7 @@ public class ExecutionFactory extends AbstractComponent { @Inject public ExecutionFactory(ChainsConfig chainsConfig, IndexInfoConfig indexInfo, - DocumentdbInfoConfig documentdbInfo, + SchemaInfoConfig schemaInfo, QrSearchersConfig clusters, ComponentRegistry<Searcher> searchers, SpecialtokensConfig specialTokens, @@ -60,7 +60,7 @@ public class ExecutionFactory extends AbstractComponent { Executor executor) { this.searchChainRegistry = createSearchChainRegistry(searchers, chainsConfig); this.indexFacts = new IndexFacts(new IndexModel(indexInfo, clusters)).freeze(); - this.schemaInfo = new SchemaInfo(indexInfo, documentdbInfo, clusters); + this.schemaInfo = new SchemaInfo(indexInfo, schemaInfo, clusters); this.specialTokens = new SpecialTokenRegistry(specialTokens); this.linguistics = linguistics; this.renderingExecutor = createRenderingExecutor(); @@ -78,7 +78,7 @@ public class ExecutionFactory extends AbstractComponent { Linguistics linguistics, ComponentRegistry<Renderer> renderers, Executor executor) { - this(chainsConfig, indexInfo, new DocumentdbInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, executor); + this(chainsConfig, indexInfo, new SchemaInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, executor); } /** @deprecated pass the container threadpool */ @@ -90,7 +90,7 @@ public class ExecutionFactory extends AbstractComponent { SpecialtokensConfig specialTokens, Linguistics linguistics, ComponentRegistry<Renderer> renderers) { - this(chainsConfig, indexInfo, new DocumentdbInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, null); + this(chainsConfig, indexInfo, new SchemaInfoConfig.Builder().build(), clusters, searchers, specialTokens, linguistics, renderers, null); } private SearchChainRegistry createSearchChainRegistry(ComponentRegistry<Searcher> searchers, @@ -144,7 +144,7 @@ public class ExecutionFactory extends AbstractComponent { public static ExecutionFactory empty() { return new ExecutionFactory(new ChainsConfig.Builder().build(), new IndexInfoConfig.Builder().build(), - new DocumentdbInfoConfig.Builder().build(), + new SchemaInfoConfig.Builder().build(), new QrSearchersConfig.Builder().build(), new ComponentRegistry<>(), new SpecialtokensConfig.Builder().build(), |