aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/search/IndexingDocproc.java
blob: 2c9b5389a9eaa3339ca07e3b47b664c3633b8ec8 (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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.yahoo.vespa.model.search;

import com.yahoo.vespa.model.container.docproc.DocprocChain;

/**
 * Utility class to track configuration for which indexing docproc to use by a search cluster.
 */
public class IndexingDocproc {

    private String clusterName; // The name of the docproc cluster to run indexing, by config.
    private String chainName;

    private DocprocChain chain; // The actual docproc chain indexing for this.

    public boolean hasExplicitCluster() {
        return clusterName != null;
    }

    public boolean hasExplicitChain() {
        return chainName != null;
    }

    /**
     * Returns the name of the docproc cluster running indexing for this search cluster. This is derived from the
     * services file on initialization, this can NOT be used at runtime to determine indexing chain. When initialization
     * is done, the {@link #getServiceName()} method holds the actual indexing docproc chain object.
     *
     * @return the name of the docproc cluster associated with this
     */
    public String getClusterName(String searchClusterName) {
        return hasExplicitCluster() ? clusterName : searchClusterName + ".indexing";
    }

    public String getChainName() {
        return chainName;
    }

    public void setChainName(String name) {
        chainName = name;
    }

    /**
     * Sets the name of the docproc cluster running indexing for this search cluster. This is for initial configuration,
     * and will not reflect the actual indexing chain. See {@link #getClusterName} for more detail.
     *
     * @param name the name of the docproc cluster associated with this
     */
    public void setClusterName(String name) {
        clusterName = name;
    }

    public String getServiceName() {
        return chain.getServiceName();
    }

    /**
     * Sets the docproc chain that will be running indexing for this search cluster. This is set by the
     * {@link com.yahoo.vespa.model.content.Content} model during build.
     *
     * @param chain the chain that is to run indexing for this cluster
     */
    public void setChain(DocprocChain chain) { this.chain = chain; }

    public IndexingDocproc() {
        clusterName = null;
        chainName = null;
        chain = null;
    }

}