Search in sources :

Example 1 with TargetSpec

use of com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec 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 2 with TargetSpec

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

the class FederationSearcher method addSourceTargets.

private void addSourceTargets(TargetResolver targetResolver, List<TargetSpec> targets) {
    for (TargetSpec targetSpec : targets) {
        Target target = targetResolver.resolve(targetSpec);
        if (target == null) {
            throw new RuntimeException("Can't find source " + targetSpec.sourceSpec + " used as a source for federation '" + getComponentId() + "'");
        }
        Target duplicate = resolvedTargets.put(target.id, target);
        if (duplicate != null && !duplicate.targetOptions.equals(target.targetOptions)) {
            throw new RuntimeException("Search chain " + target.id + " added twice with different federation options" + " to the federation searcher " + getComponentId());
        }
    }
}
Also used : TargetSpec(com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec)

Aggregations

TargetSpec (com.yahoo.search.searchchain.model.federation.FederationSearcherModel.TargetSpec)2 ComponentSpecification (com.yahoo.component.ComponentSpecification)1 FederationOptions (com.yahoo.search.searchchain.model.federation.FederationOptions)1