Search in sources :

Example 6 with FederationOptions

use of com.yahoo.search.searchchain.model.federation.FederationOptions in project vespa by vespa-engine.

the class FederationSearcher method addDefaultTargets.

private void addDefaultTargets(TargetResolver targetResolver, ComponentRegistry<SearchChain> searchChainRegistry) {
    for (GenericTarget genericTarget : defaultTargets(searchChainRegistry.allComponents())) {
        ComponentSpecification specification = genericTarget.getComponentId().toSpecification();
        // Can't use genericTarget directly, as it might be part of a source group.
        Target federationTarget = targetResolver.resolve(new TargetSpec(specification, new FederationOptions()));
        // Do not replace manually added sources, as they might have manually configured federation options
        if (!resolvedTargets.containsKey(federationTarget.id))
            resolvedTargets.put(federationTarget.id, federationTarget);
    }
}
Also used : FederationOptions(com.yahoo.search.searchchain.model.federation.FederationOptions) ComponentSpecification(com.yahoo.component.ComponentSpecification) TargetSpec(com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec)

Example 7 with FederationOptions

use of com.yahoo.search.searchchain.model.federation.FederationOptions in project vespa by vespa-engine.

the class FederationSearcherTestCase method createMultiProviderFederationSearcher.

private FederationSearcher createMultiProviderFederationSearcher() {
    FederationOptions options = new FederationOptions();
    SearchChainResolver.Builder builder = new SearchChainResolver.Builder();
    ComponentId provider1 = new ComponentId("provider1");
    ComponentId provider2 = new ComponentId("provider2");
    ComponentId news = new ComponentId("news");
    builder.addSearchChain(provider1, options, Collections.<String>emptyList());
    builder.addSearchChain(provider2, options, Collections.<String>emptyList());
    builder.addSourceForProvider(news, provider1, provider1, true, options, Collections.<String>emptyList());
    builder.addSourceForProvider(news, provider2, provider2, false, options, Collections.<String>emptyList());
    return new FederationSearcher(new ComponentId("federation"), builder.build());
}
Also used : FederationOptions(com.yahoo.search.searchchain.model.federation.FederationOptions) FederationSearcher(com.yahoo.search.federation.FederationSearcher) SearchChainResolver(com.yahoo.search.federation.sourceref.SearchChainResolver) ComponentId(com.yahoo.component.ComponentId)

Aggregations

FederationOptions (com.yahoo.search.searchchain.model.federation.FederationOptions)7 Test (org.junit.Test)4 ComponentId (com.yahoo.component.ComponentId)2 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)2 Query (com.yahoo.search.Query)2 Result (com.yahoo.search.Result)2 FederationSearcher (com.yahoo.search.federation.FederationSearcher)2 SearchChainResolver (com.yahoo.search.federation.sourceref.SearchChainResolver)2 ComponentSpecification (com.yahoo.component.ComponentSpecification)1 Chain (com.yahoo.component.chain.Chain)1 Searcher (com.yahoo.search.Searcher)1 Hit (com.yahoo.search.result.Hit)1 HitGroup (com.yahoo.search.result.HitGroup)1 Execution (com.yahoo.search.searchchain.Execution)1 SearchChainRegistry (com.yahoo.search.searchchain.SearchChainRegistry)1 TargetSpec (com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec)1 HttpProvider (com.yahoo.vespa.model.container.search.searchchain.HttpProvider)1 LocalProvider (com.yahoo.vespa.model.container.search.searchchain.LocalProvider)1 Provider (com.yahoo.vespa.model.container.search.searchchain.Provider)1 Source (com.yahoo.vespa.model.container.search.searchchain.Source)1