aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/searchchain/ForkingSearcher.java
blob: 78daf9a59afe25eaabf05c295d2d4193db0dbcc0 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.searchchain;

import com.yahoo.component.ComponentId;
import com.yahoo.component.chain.Chain;
import com.yahoo.search.Searcher;

import java.util.Collection;

/**
 * Searchers which invokes other search chains should override this.
 *
 * @author bratseth
 */
public abstract class ForkingSearcher extends Searcher {

    public ForkingSearcher() {}

    /** A search chain with a comment about when it is used. */
    public static class CommentedSearchChain {
        public final String comment;
        public final Chain<Searcher> searchChain;

        public CommentedSearchChain(String comment, Chain<Searcher> searchChain) {
            this.comment = comment;
            this.searchChain = searchChain;
        }
    }

    /** Returns which searchers this searcher may forward to, for debugging and tracing */
    public abstract Collection<CommentedSearchChain> getSearchChainsForwarded(SearchChainRegistry registry);

}