aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/searchchain/model/federation/FederationSearcherModel.java
blob: f39528b3c0f4f02492abd95149d34d9cfc9b884f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchchain.model.federation;

import java.util.List;

import com.yahoo.container.bundle.BundleInstantiationSpecification;

import com.yahoo.component.ComponentSpecification;
import com.yahoo.component.chain.dependencies.Dependencies;
import com.yahoo.component.chain.model.ChainedComponentModel;
import com.yahoo.search.federation.FederationSearcher;

/**
 * Specifies how a federation searcher is to be set up.
 *
 * @author Tony Vaagenes
 */
public class FederationSearcherModel extends ChainedComponentModel {

    private static final ComponentSpecification federationSearcherComponentSpecification =
            new ComponentSpecification(FederationSearcher.class.getName());

    public final List<TargetSpec> targets;
    public final boolean inheritDefaultSources;

    public FederationSearcherModel(ComponentSpecification componentId,
                                   Dependencies dependencies,
                                   List<TargetSpec> targets,
                                   boolean inheritDefaultSources) {
        super(BundleInstantiationSpecification.fromSearchAndDocproc(componentId, federationSearcherComponentSpecification),
              dependencies);
        this.inheritDefaultSources = inheritDefaultSources;
        this.targets = List.copyOf(targets);
    }

    /** Specifies one or more search chains that can be addressed as a single source. */
    public static class TargetSpec {

        public final ComponentSpecification sourceSpec;
        public final FederationOptions federationOptions;

        public TargetSpec(ComponentSpecification sourceSpec, FederationOptions federationOptions) {
            this.sourceSpec = sourceSpec;
            this.federationOptions = federationOptions;
        }
    }

}