Search in sources :

Example 1 with QrSearchersConfig

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);
}
Also used : CachingSearcher(com.yahoo.prelude.searcher.CachingSearcher) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) DocumentSourceSearcher(com.yahoo.prelude.searcher.DocumentSourceSearcher) Before(org.junit.Before)

Example 2 with QrSearchersConfig

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);
}
Also used : Chain(com.yahoo.component.chain.Chain) Query(com.yahoo.search.Query) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) JuniperSearcher(com.yahoo.prelude.searcher.JuniperSearcher) DocumentSourceSearcher(com.yahoo.search.searchchain.testutil.DocumentSourceSearcher) ComponentId(com.yahoo.component.ComponentId)

Example 3 with QrSearchersConfig

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;
}
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 4 with QrSearchersConfig

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));
}
Also used : IndexFacts(com.yahoo.prelude.IndexFacts) ConfigGetter(com.yahoo.config.subscription.ConfigGetter) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) IndexInfoConfig(com.yahoo.search.config.IndexInfoConfig) IndexModel(com.yahoo.prelude.IndexModel)

Example 5 with QrSearchersConfig

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

Aggregations

QrSearchersConfig (com.yahoo.container.QrSearchersConfig)8 ConfigGetter (com.yahoo.config.subscription.ConfigGetter)3 IndexFacts (com.yahoo.prelude.IndexFacts)3 IndexModel (com.yahoo.prelude.IndexModel)3 Query (com.yahoo.search.Query)3 ClusterConfig (com.yahoo.search.config.ClusterConfig)3 IndexInfoConfig (com.yahoo.search.config.IndexInfoConfig)3 Execution (com.yahoo.search.searchchain.Execution)3 Test (org.junit.Test)3 ComponentId (com.yahoo.component.ComponentId)2 Chain (com.yahoo.component.chain.Chain)2 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 StemmingSearcher (com.yahoo.prelude.querytransform.StemmingSearcher)1 CachingSearcher (com.yahoo.prelude.searcher.CachingSearcher)1 DocumentSourceSearcher (com.yahoo.prelude.searcher.DocumentSourceSearcher)1 JuniperSearcher (com.yahoo.prelude.searcher.JuniperSearcher)1