aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/federation/selection/TargetSelector.java
blob: 483cbf25904d3f22ed7b847234218d4b85c034df (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.federation.selection;

import com.yahoo.processing.execution.chain.ChainRegistry;
import com.yahoo.search.Query;
import com.yahoo.search.Result;
import com.yahoo.search.Searcher;
import com.yahoo.search.federation.selection.FederationTarget;

import java.util.Collection;

/**
 * Allows adding extra targets that the federation searcher should federate to.
 *
 * For each federation search call, the federation searcher will call targetSelector.getTargets.
 *
 * Then, for each target, it will:
 * 1) call modifyTargetQuery(target, query)
 * 2) call modifyTargetResult(target, result)
 *
 * @author Tony Vaagenes
 */
public interface TargetSelector<T> {

    Collection<FederationTarget<T>> getTargets(Query query, ChainRegistry<Searcher> searcherChainRegistry);

    /**
     * For modifying the query before sending it to a the target
     */
    void modifyTargetQuery(FederationTarget<T> target, Query query);

    /**
     * For modifying the result produced by the target.
     */
    void modifyTargetResult(FederationTarget<T> target, Result result);

}