use of com.yahoo.container.QrSearchersConfig in project vespa by vespa-engine.
the class CachingSearcherTestCase method setUp.
@Before
public void setUp() throws Exception {
hits = new DocumentSourceSearcher();
QrSearchersConfig config = new QrSearchersConfig(new QrSearchersConfig.Builder().com(new QrSearchersConfig.Com.Builder().yahoo(new QrSearchersConfig.Com.Yahoo.Builder().prelude(new QrSearchersConfig.Com.Yahoo.Prelude.Builder().searcher(new QrSearchersConfig.Com.Yahoo.Prelude.Searcher.Builder().CachingSearcher(new QrSearchersConfig.Com.Yahoo.Prelude.Searcher.CachingSearcher.Builder().cachesizemegabytes(10).maxentrysizebytes(5 * 1024 * 1024).timetoliveseconds(86400)))))));
CachingSearcher cache = new CachingSearcher(config, Statistics.nullImplementation);
searchChain = new Chain<>(cache, hits);
}
use of com.yahoo.container.QrSearchersConfig in project vespa by vespa-engine.
the class JuniperSearcherTestCase method createSearchChain.
/**
* Creates a search chain which always returns a result with one hit containing information given in this
*
* @param sdName the search definition type of the returned hit
* @param content the content of the "dynteaser" field of the returned hit
*/
private Chain<Searcher> createSearchChain(String sdName, String content) {
JuniperSearcher searcher = new JuniperSearcher(new ComponentId("test"), new QrSearchersConfig(new QrSearchersConfig.Builder()));
DocumentSourceSearcher docsource = new DocumentSourceSearcher();
addResult(new Query("?query=12"), sdName, content, docsource);
addResult(new Query("?query=12&bolding=false"), sdName, content, docsource);
return new Chain<Searcher>(searcher, docsource);
}
use of com.yahoo.container.QrSearchersConfig 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.container.QrSearchersConfig in project vespa by vespa-engine.
the class ParsingTester method createIndexFacts.
/**
* Returns an unfrozen version of the IndexFacts this will use.
* This can be used to add new indexes and passing the resulting IndexFacts to the constructor of this.
*/
public static IndexFacts createIndexFacts() {
String indexInfoConfigID = "file:src/test/java/com/yahoo/prelude/query/parser/test/parseindexinfo.cfg";
ConfigGetter<IndexInfoConfig> getter = new ConfigGetter<>(IndexInfoConfig.class);
IndexInfoConfig config = getter.getConfig(indexInfoConfigID);
return new IndexFacts(new IndexModel(config, (QrSearchersConfig) null));
}
use of com.yahoo.container.QrSearchersConfig 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"));
}
Aggregations