summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorgjoranv <gv@verizonmedia.com>2020-05-20 12:03:43 +0200
committerGitHub <noreply@github.com>2020-05-20 12:03:43 +0200
commit7b9fd033c405fdbd1fdc11b0223382e11c3931d2 (patch)
tree63e23b4e8ea7fc06cac9e3b243916964ab189551 /config-model
parent857a9721486ba2294516714e2068740436ece82a (diff)
parent98bb2cb3bc92011776cf7ff285649aa565258c2a (diff)
Merge pull request #13311 from vespa-engine/gjoranv/create-registry-from-config
Gjoranv/create registry from config
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java6
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/SearchBuilderTest.java10
2 files changed, 16 insertions, 0 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
index 4c4b1ca7f82..8002f89a2e7 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/container/search/ContainerSearch.java
@@ -5,10 +5,12 @@ import com.yahoo.container.QrSearchersConfig;
import com.yahoo.prelude.semantics.SemanticRulesConfig;
import com.yahoo.search.config.IndexInfoConfig;
import com.yahoo.search.pagetemplates.PageTemplatesConfig;
+import com.yahoo.search.query.profile.compiled.CompiledQueryProfileRegistry;
import com.yahoo.search.query.profile.config.QueryProfilesConfig;
import com.yahoo.vespa.configdefinition.IlscriptsConfig;
import com.yahoo.vespa.model.container.ApplicationContainerCluster;
import com.yahoo.vespa.model.container.component.ContainerSubsystem;
+import com.yahoo.vespa.model.container.component.SimpleComponent;
import com.yahoo.vespa.model.container.search.searchchain.LocalProvider;
import com.yahoo.vespa.model.container.search.searchchain.SearchChains;
import com.yahoo.vespa.model.search.AbstractSearchCluster;
@@ -34,6 +36,8 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
SemanticRulesConfig.Producer,
PageTemplatesConfig.Producer {
+ public static final String QUERY_PROFILE_REGISTRY_CLASS = CompiledQueryProfileRegistry.class.getName();
+
private ApplicationContainerCluster owningCluster;
private final List<AbstractSearchCluster> searchClusters = new LinkedList<>();
private final Options options;
@@ -46,6 +50,8 @@ public class ContainerSearch extends ContainerSubsystem<SearchChains>
super(chains);
this.owningCluster = cluster;
this.options = options;
+
+ owningCluster.addComponent(new SimpleComponent(QUERY_PROFILE_REGISTRY_CLASS));
}
public void connectSearchClusters(Map<String, AbstractSearchCluster> searchClusters) {
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/SearchBuilderTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/SearchBuilderTest.java
index 47f37a75fd0..a2d13439f4e 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/SearchBuilderTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/SearchBuilderTest.java
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.container.xml;
+import com.yahoo.component.ComponentId;
import com.yahoo.config.model.builder.xml.test.DomBuilderTest;
import com.yahoo.container.core.ChainsConfig;
import com.yahoo.container.jdisc.JdiscBindingsConfig;
@@ -16,6 +17,7 @@ import org.w3c.dom.Element;
import static com.yahoo.config.model.api.container.ContainerServiceType.QRSERVER;
import static com.yahoo.test.Matchers.hasItemWithMethod;
+import static com.yahoo.vespa.model.container.search.ContainerSearch.QUERY_PROFILE_REGISTRY_CLASS;
import static com.yahoo.vespa.model.container.xml.ContainerModelBuilder.SEARCH_HANDLER_BINDING;
import static com.yahoo.vespa.model.container.xml.ContainerModelBuilder.SEARCH_HANDLER_CLASS;
import static org.hamcrest.CoreMatchers.is;
@@ -127,6 +129,14 @@ public class SearchBuilderTest extends ContainerModelBuilderTestBase {
assertThat(chainsConfig().chains(), hasItemWithMethod("vespa", "id"));
}
+ @Test
+ public void query_profiles_registry_component_is_added() {
+ createClusterWithOnlyDefaultChains();
+ ApplicationContainerCluster cluster = (ApplicationContainerCluster)root.getChildren().get("default");
+ var queryProfileRegistryId = ComponentId.fromString(QUERY_PROFILE_REGISTRY_CLASS);
+ assertTrue(cluster.getComponentsMap().containsKey(queryProfileRegistryId));
+ }
+
private void createClusterWithOnlyDefaultChains() {
Element containerElem = DomBuilderTest.parse(
"<container id='default' version='1.0'>",