Search in sources :

Example 1 with ClusterConfig

use of com.yahoo.search.config.ClusterConfig in project vespa by vespa-engine.

the class ClusterSearcherTestCase method createSearcher.

private static ClusterSearcher createSearcher(Double maxQueryTimeout, Double maxQueryCacheTimeout) {
    ComponentId id = new ComponentId("test-id");
    QrSearchersConfig qrsCfg = new QrSearchersConfig(new QrSearchersConfig.Builder().searchcluster(new QrSearchersConfig.Searchcluster.Builder().name("test-cluster")));
    ClusterConfig.Builder clusterCfgBld = new ClusterConfig.Builder().clusterName("test-cluster");
    if (maxQueryTimeout != null) {
        clusterCfgBld.maxQueryTimeout(maxQueryTimeout);
    }
    if (maxQueryCacheTimeout != null) {
        clusterCfgBld.maxQueryCacheTimeout(maxQueryCacheTimeout);
    }
    ClusterConfig clusterCfg = new ClusterConfig(clusterCfgBld);
    DocumentdbInfoConfig documentDbCfg = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("type1")));
    LegacyEmulationConfig emulationCfg = new LegacyEmulationConfig(new LegacyEmulationConfig.Builder());
    QrMonitorConfig monitorCfg = new QrMonitorConfig(new QrMonitorConfig.Builder());
    Statistics statistics = Statistics.nullImplementation;
    Fs4Config fs4Cfg = new Fs4Config(new Fs4Config.Builder());
    FS4ResourcePool fs4ResourcePool = new FS4ResourcePool(fs4Cfg);
    ClusterSearcher searcher = new ClusterSearcher(id, qrsCfg, clusterCfg, documentDbCfg, emulationCfg, monitorCfg, new DispatchConfig(new DispatchConfig.Builder()), createClusterInfoConfig(), statistics, fs4ResourcePool, new VipStatus());
    return searcher;
}
Also used : DispatchConfig(com.yahoo.vespa.config.search.DispatchConfig) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) VipStatus(com.yahoo.container.handler.VipStatus) Fs4Config(com.yahoo.container.search.Fs4Config) Statistics(com.yahoo.statistics.Statistics) FS4ResourcePool(com.yahoo.prelude.fastsearch.FS4ResourcePool) DocumentdbInfoConfig(com.yahoo.prelude.fastsearch.DocumentdbInfoConfig) LegacyEmulationConfig(com.yahoo.container.search.LegacyEmulationConfig) ComponentId(com.yahoo.component.ComponentId) ClusterConfig(com.yahoo.search.config.ClusterConfig)

Example 2 with ClusterConfig

use of com.yahoo.search.config.ClusterConfig in project vespa by vespa-engine.

the class SearchChainsTest method subscribe.

@Before
public void subscribe() {
    ChainsConfig.Builder chainsBuilder = new ChainsConfig.Builder();
    chainsBuilder = (ChainsConfig.Builder) root.getConfig(chainsBuilder, "searchchains");
    chainsConfig = new ChainsConfig(chainsBuilder);
    ProviderConfig.Builder providerBuilder = new ProviderConfig.Builder();
    providerBuilder = (ProviderConfig.Builder) root.getConfig(providerBuilder, "searchchains/chain/provider:1/component/com.yahoo.search.federation.vespa.VespaSearcher");
    providerConfig = new ProviderConfig(providerBuilder);
    ClusterConfig.Builder clusterBuilder = new ClusterConfig.Builder();
    clusterBuilder = (ClusterConfig.Builder) root.getConfig(clusterBuilder, "searchchains/chain/cluster2/component/" + ClusterSearcher.class.getName());
    clusterConfig = new ClusterConfig(clusterBuilder);
}
Also used : ProviderConfig(com.yahoo.search.federation.ProviderConfig) ChainsConfig(com.yahoo.container.core.ChainsConfig) ClusterConfig(com.yahoo.search.config.ClusterConfig) Before(org.junit.Before)

Example 3 with ClusterConfig

use of com.yahoo.search.config.ClusterConfig in project vespa by vespa-engine.

the class SearchClusterTest method search_model_is_connected_to_container_clusters_two_content_clusters.

@Test
public void search_model_is_connected_to_container_clusters_two_content_clusters() throws Exception {
    String services = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" + "<services version=\"1.0\">" + "  <admin version='2.0'>" + "    <adminserver hostalias='node0' />" + "  </admin>\n" + "  <jdisc version='1.0' id='j1'>\n" + "    <search>" + "      <chain id='s1Chain'>" + "        <searcher id='S1ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='normal' id='normal' type='local'/>\n" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node0\" />" + "    </nodes>" + "  </jdisc>" + "  <jdisc version='1.0' id='j2'>" + "    <search>" + "      <chain id='s2Chain'>" + "        <searcher id='S2ClusterSearcher'/>" + "      </chain>" + "      <provider cluster='xbulk' id='xbulk' type='local'/>" + "    </search>" + "    <nodes>" + "      <node hostalias=\"node2\" />" + "    </nodes>" + "  </jdisc>" + "  <content id='xbulk' version=\"1.0\">" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node0\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "  <content id=\"normal\" version='1.0'>" + "     <redundancy>2</redundancy>" + "     <documents>" + "       <document mode='index' type=\"music\" />" + "     </documents>" + "         <nodes>" + "            <node hostalias=\"node2\" distribution-key=\"0\" />" + "         </nodes>" + "  </content>" + "</services>";
    VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, services, ApplicationPackageUtils.generateSearchDefinitions("music")).create();
    ContainerCluster cluster1 = (ContainerCluster) model.getConfigProducer("j1").get();
    assertFalse(cluster1.getSearch().getChains().localProviders().isEmpty());
    ContainerCluster cluster2 = (ContainerCluster) model.getConfigProducer("j2").get();
    assertFalse(cluster2.getSearch().getChains().localProviders().isEmpty());
    QrSearchersConfig.Builder builder = new QrSearchersConfig.Builder();
    cluster1.getConfig(builder);
    QrSearchersConfig config = new QrSearchersConfig(builder);
    assertThat(config.searchcluster().size(), is(2));
    int normalId = 0;
    int bulkId = 1;
    assertThat(config.searchcluster().get(normalId).name(), is("normal"));
    assertThat(config.searchcluster().get(bulkId).name(), is("xbulk"));
    ClusterConfig.Builder clusterConfigBuilder = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder, "j1/searchchains/chain/normal/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig = new ClusterConfig(clusterConfigBuilder);
    assertThat(clusterConfig.clusterId(), is(normalId));
    assertThat(clusterConfig.clusterName(), is("normal"));
    ClusterConfig.Builder clusterConfigBuilder2 = new ClusterConfig.Builder();
    model.getConfig(clusterConfigBuilder2, "j2/searchchains/chain/xbulk/component/com.yahoo.prelude.cluster.ClusterSearcher");
    ClusterConfig clusterConfig2 = new ClusterConfig(clusterConfigBuilder2);
    assertThat(clusterConfig2.clusterId(), is(bulkId));
    assertThat(clusterConfig2.clusterName(), is("xbulk"));
}
Also used : VespaModelCreatorWithMockPkg(com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg) VespaModel(com.yahoo.vespa.model.VespaModel) SearchBuilder(com.yahoo.searchdefinition.SearchBuilder) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) ContainerCluster(com.yahoo.vespa.model.container.ContainerCluster) ClusterConfig(com.yahoo.search.config.ClusterConfig) Test(org.junit.Test)

Example 4 with ClusterConfig

use of com.yahoo.search.config.ClusterConfig in project vespa by vespa-engine.

the class GroupingValidatorTestCase method validateGrouping.

private static void validateGrouping(String clusterName, Collection<String> attributeNames, Query query) {
    QrSearchersConfig.Builder qrsConfig = new QrSearchersConfig.Builder().searchcluster(new QrSearchersConfig.Searchcluster.Builder().indexingmode(QrSearchersConfig.Searchcluster.Indexingmode.Enum.REALTIME).name(clusterName));
    ClusterConfig.Builder clusterConfig = new ClusterConfig.Builder().clusterId(0).clusterName("test");
    AttributesConfig.Builder attributesConfig = new AttributesConfig.Builder();
    for (String attributeName : attributeNames) {
        attributesConfig.attribute(new AttributesConfig.Attribute.Builder().name(attributeName));
    }
    new Execution(new GroupingValidator(new QrSearchersConfig(qrsConfig), new ClusterConfig(clusterConfig), new AttributesConfig(attributesConfig)), Execution.Context.createContextStub()).search(query);
}
Also used : Execution(com.yahoo.search.searchchain.Execution) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) AttributesConfig(com.yahoo.vespa.config.search.AttributesConfig) ClusterConfig(com.yahoo.search.config.ClusterConfig)

Aggregations

ClusterConfig (com.yahoo.search.config.ClusterConfig)4 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)3 ComponentId (com.yahoo.component.ComponentId)1 ChainsConfig (com.yahoo.container.core.ChainsConfig)1 VipStatus (com.yahoo.container.handler.VipStatus)1 Fs4Config (com.yahoo.container.search.Fs4Config)1 LegacyEmulationConfig (com.yahoo.container.search.LegacyEmulationConfig)1 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)1 FS4ResourcePool (com.yahoo.prelude.fastsearch.FS4ResourcePool)1 ProviderConfig (com.yahoo.search.federation.ProviderConfig)1 Execution (com.yahoo.search.searchchain.Execution)1 SearchBuilder (com.yahoo.searchdefinition.SearchBuilder)1 Statistics (com.yahoo.statistics.Statistics)1 AttributesConfig (com.yahoo.vespa.config.search.AttributesConfig)1 DispatchConfig (com.yahoo.vespa.config.search.DispatchConfig)1 VespaModel (com.yahoo.vespa.model.VespaModel)1 ContainerCluster (com.yahoo.vespa.model.container.ContainerCluster)1 VespaModelCreatorWithMockPkg (com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg)1 Before (org.junit.Before)1 Test (org.junit.Test)1