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;
}
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);
}
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"));
}
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);
}
Aggregations