aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/result/Coverage.java
blob: 7bc49fdb0b1d22721e2a1fc80c96853497d11bf1 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;

import com.google.common.annotations.Beta;

/**
 * The coverage report for a result set.
 *
 * @author Steinar Knutsen
 * @author baldersheim
 */
public class Coverage extends com.yahoo.container.handler.Coverage {

    public Coverage(long docs, long active) {
        this(docs, active, docs > 1 ? 1 : 0, docs > 1 ? 1: 0);
    }

    public Coverage(long docs, long active, int nodes) {
        super(docs, active, nodes, 1);
    }

    public Coverage(long docs, long active, int nodes, int resultSets) {
        super(docs, active, nodes, resultSets);
    }

    // TODO: Remove on Vespa 7
    /** @deprecated don't send a "full" boolean */
    @Deprecated // OK
    public Coverage(long docs, int nodes, boolean full) {
        this(docs, nodes, full, 1);
    }

    // TODO: Remove on Vespa 7
    /** @deprecated don't send a "full" boolean */
    @Deprecated // OK
    public Coverage(long docs, int nodes, boolean full, int resultSets) {
        super(docs, nodes, full, resultSets);
    }

    /**
     * Will set number of documents present in ideal state
     *
     * @param soonActive Number of documents active in ideal state
     * @return self for chaining
     */
    @Beta
    public Coverage setSoonActive(long soonActive) { this.soonActive = soonActive; return this; }

    /**
     * Will set the reasons for degraded coverage as reported by vespa backend.
     *
     * @param degradedReason Reason for degradation
     * @return self for chaining
     */
    public Coverage setDegradedReason(int degradedReason) { this.degradedReason = degradedReason; return this; }

    public Coverage setNodesTried(int nodesTried) { super.setNodesTried(nodesTried); return this; }
}