diff options
Diffstat (limited to 'container-search')
14 files changed, 72 insertions, 49 deletions
diff --git a/container-search/abi-spec.json b/container-search/abi-spec.json index 2ab51f975a4..bf7302e4105 100644 --- a/container-search/abi-spec.json +++ b/container-search/abi-spec.json @@ -2855,7 +2855,7 @@ "public" ], "methods": [ - "public void <init>(com.yahoo.search.config.IndexInfoConfig, com.yahoo.prelude.fastsearch.DocumentdbInfoConfig, com.yahoo.container.QrSearchersConfig)", + "public void <init>(com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.search.SchemaInfoConfig, com.yahoo.container.QrSearchersConfig)", "public void <init>(java.util.List, java.util.Map)", "public com.yahoo.search.config.SchemaInfo$Session newSession(com.yahoo.search.Query)", "public static com.yahoo.search.config.SchemaInfo empty()", @@ -8642,7 +8642,7 @@ "public" ], "methods": [ - "public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.prelude.fastsearch.DocumentdbInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)", + "public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.search.SchemaInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)", "public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry, java.util.concurrent.Executor)", "public void <init>(com.yahoo.container.core.ChainsConfig, com.yahoo.search.config.IndexInfoConfig, com.yahoo.container.QrSearchersConfig, com.yahoo.component.provider.ComponentRegistry, com.yahoo.vespa.configdefinition.SpecialtokensConfig, com.yahoo.language.Linguistics, com.yahoo.component.provider.ComponentRegistry)", "public com.yahoo.search.searchchain.Execution newExecution(com.yahoo.component.chain.Chain)", 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(), diff --git a/container-search/src/main/resources/configdefinitions/container.search.schema-info.def b/container-search/src/main/resources/configdefinitions/container.search.schema-info.def new file mode 100644 index 00000000000..8bd34c21ad3 --- /dev/null +++ b/container-search/src/main/resources/configdefinitions/container.search.schema-info.def @@ -0,0 +1,25 @@ +# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +namespace=container.search + +## The name of this schema +schema[].name string + +## The id of the summary class +# schema[].summaryclass[].id int +## The name of the summary class +# schema[].summaryclass[].name string +## The name of a field in the summary class +# schema[].summaryclass[].fields[].name string +## The type of a field in the summary class +# schema[].summaryclass[].fields[].type string +## Whether this field is a dynamic snippet +# schema[].summaryclass[].fields[].dynamic bool default=false + +## Information about rank profiles +schema[].rankprofile[].name string +schema[].rankprofile[].hasSummaryFeatures bool default=true +schema[].rankprofile[].hasRankFeatures bool default=true +# The name of an input (query rank feature) accepted by this profile +schema[].rankprofile[].input[].name string +# The tensor type of an input (query rank feature) accepted by this profile +schema[].rankprofile[].input[].type string diff --git a/container-search/src/test/java/com/yahoo/search/config/SchemaInfoTester.java b/container-search/src/test/java/com/yahoo/search/config/SchemaInfoTester.java index d5b4522f3aa..4e84324a779 100644 --- a/container-search/src/test/java/com/yahoo/search/config/SchemaInfoTester.java +++ b/container-search/src/test/java/com/yahoo/search/config/SchemaInfoTester.java @@ -2,10 +2,9 @@ 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.search.Query; import com.yahoo.tensor.TensorType; -import com.yahoo.yolean.Exceptions; import java.util.ArrayList; import java.util.HashMap; @@ -86,36 +85,36 @@ public class SchemaInfoTester { static SchemaInfo createSchemaInfoFromConfig() { var indexInfoConfig = new IndexInfoConfig.Builder(); - var rankProfileCommon = new DocumentdbInfoConfig.Documentdb.Rankprofile.Builder(); + var rankProfileCommon = new SchemaInfoConfig.Schema.Rankprofile.Builder(); rankProfileCommon.name("commonProfile"); - rankProfileCommon.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); - rankProfileCommon.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor2)").type("tensor(x[2],y[2])")); - rankProfileCommon.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor3)").type("tensor(x[2],y[2])")); - rankProfileCommon.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor4)").type("tensor<float>(x[5])")); + rankProfileCommon.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); + rankProfileCommon.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor2)").type("tensor(x[2],y[2])")); + rankProfileCommon.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor3)").type("tensor(x[2],y[2])")); + rankProfileCommon.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor4)").type("tensor<float>(x[5])")); - var documentDbInfoInfoConfig = new DocumentdbInfoConfig.Builder(); + var schemaInfoInfoConfig = new SchemaInfoConfig.Builder(); - var documentDbA = new DocumentdbInfoConfig.Documentdb.Builder(); - documentDbA.name("a"); - documentDbA.rankprofile(rankProfileCommon); - var rankProfileInconsistentA = new DocumentdbInfoConfig.Documentdb.Rankprofile.Builder(); + var schemaA = new SchemaInfoConfig.Schema.Builder(); + schemaA.name("a"); + schemaA.rankprofile(rankProfileCommon); + var rankProfileInconsistentA = new SchemaInfoConfig.Schema.Rankprofile.Builder(); rankProfileInconsistentA.name("inconsistent"); - rankProfileInconsistentA.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); - documentDbA.rankprofile(rankProfileInconsistentA); - documentDbInfoInfoConfig.documentdb(documentDbA); - - var documentDbB = new DocumentdbInfoConfig.Documentdb.Builder(); - documentDbB.name("b"); - documentDbB.rankprofile(rankProfileCommon); - var rankProfileInconsistentB = new DocumentdbInfoConfig.Documentdb.Rankprofile.Builder(); + rankProfileInconsistentA.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); + schemaA.rankprofile(rankProfileInconsistentA); + schemaInfoInfoConfig.schema(schemaA); + + var schemaB = new SchemaInfoConfig.Schema.Builder(); + schemaB.name("b"); + schemaB.rankprofile(rankProfileCommon); + var rankProfileInconsistentB = new SchemaInfoConfig.Schema.Rankprofile.Builder(); rankProfileInconsistentB.name("inconsistent"); - rankProfileInconsistentB.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(x[10])")); - documentDbB.rankprofile(rankProfileInconsistentB); - var rankProfileBOnly = new DocumentdbInfoConfig.Documentdb.Rankprofile.Builder(); + rankProfileInconsistentB.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(x[10])")); + schemaB.rankprofile(rankProfileInconsistentB); + var rankProfileBOnly = new SchemaInfoConfig.Schema.Rankprofile.Builder(); rankProfileBOnly.name("bOnly"); - rankProfileBOnly.input(new DocumentdbInfoConfig.Documentdb.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); - documentDbB.rankprofile(rankProfileBOnly); - documentDbInfoInfoConfig.documentdb(documentDbB); + rankProfileBOnly.input(new SchemaInfoConfig.Schema.Rankprofile.Input.Builder().name("query(myTensor1)").type("tensor(a{},b{})")); + schemaB.rankprofile(rankProfileBOnly); + schemaInfoInfoConfig.schema(schemaB); var qrSearchersConfig = new QrSearchersConfig.Builder(); var clusterAB = new QrSearchersConfig.Searchcluster.Builder(); @@ -127,7 +126,7 @@ public class SchemaInfoTester { clusterA.searchdef("a"); qrSearchersConfig.searchcluster(clusterA); - return new SchemaInfo(indexInfoConfig.build(), documentDbInfoInfoConfig.build(), qrSearchersConfig.build()); + return new SchemaInfo(indexInfoConfig.build(), schemaInfoInfoConfig.build(), qrSearchersConfig.build()); } } diff --git a/container-search/src/test/java/com/yahoo/search/handler/test/config/schema-info.cfg b/container-search/src/test/java/com/yahoo/search/handler/test/config/schema-info.cfg new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/handler/test/config/schema-info.cfg diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typed/schema-info.cfg b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typed/schema-info.cfg new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/typed/schema-info.cfg diff --git a/container-search/src/test/java/com/yahoo/search/query/profile/config/test/untyped/schema-info.cfg b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/untyped/schema-info.cfg new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/query/profile/config/test/untyped/schema-info.cfg diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java index 7d691cae3ba..553a9233bf1 100644 --- a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/DependencyConfigTestCase.java @@ -42,7 +42,7 @@ public class DependencyConfigTestCase { } @AfterClass - public static void removeComponentsConfig() throws IOException { + public static void removeComponentsConfig() { new File(root + "/components.cfg").delete(); tearDown(); } diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java index 0f1f77d66b4..781370d9e25 100644 --- a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java +++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/SearchChainConfigurerTestCase.java @@ -155,6 +155,7 @@ public class SearchChainConfigurerTestCase { copyFile(testDir + "qr-search.cfg", cfgDir + "/qr-search.cfg"); copyFile(testDir + "qr-searchers.cfg", cfgDir + "/qr-searchers.cfg"); copyFile(testDir + "index-info.cfg", cfgDir + "/index-info.cfg"); + copyFile(testDir + "schema-info.cfg", cfgDir + "/schema-info.cfg"); copyFile(testDir + "specialtokens.cfg", cfgDir + "/specialtokens.cfg"); copyFile(testDir + "three-searchers.cfg", cfgDir + "/chains.cfg"); copyFile(testDir + "container-http.cfg", cfgDir + "/container-http.cfg"); @@ -208,6 +209,7 @@ public class SearchChainConfigurerTestCase { copyFile(testDir + "qr-search.cfg", cfgDir + "/qr-search.cfg"); copyFile(testDir + "qr-searchers.cfg", cfgDir + "/qr-searchers.cfg"); copyFile(testDir + "index-info.cfg", cfgDir + "/index-info.cfg"); + copyFile(testDir + "schema-info.cfg", cfgDir + "/schema-info.cfg"); copyFile(testDir + "specialtokens.cfg", cfgDir + "/specialtokens.cfg"); copyFile(testDir + "chainsConfigUpdate_1.cfg", cfgDir + "/chains.cfg"); copyFile(testDir + "container-http.cfg", cfgDir + "/container-http.cfg"); diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/dependencyConfig/schema-info.cfg b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/dependencyConfig/schema-info.cfg new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/dependencyConfig/schema-info.cfg diff --git a/container-search/src/test/java/com/yahoo/search/searchchain/config/test/schema-info.cfg b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/schema-info.cfg new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/container-search/src/test/java/com/yahoo/search/searchchain/config/test/schema-info.cfg |