aboutsummaryrefslogtreecommitdiffstats
path: root/container-core/src/main/java/com/yahoo/container/logging/HitCounts.java
blob: 7f4270064acc1f7c88cdf61d4868f66fbf9a0d0e (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
71
72
73
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.logging;

/**
 * A wrapper for hit counts, modelled after a search system.
 * Advanced database searches and similar could use these
 * structures as well.
 *
 * @author <a href="mailto:steinar@yahoo-inc.com">Steinar Knutsen</a>
 */
public class HitCounts {

    // see the javadoc for the accessors for short comments on each field
    private final int retrievedHits;
    private final int summaryCount;
    private final long totalHitCount;
    private final int requestedHits;
    private final int requestedOffset;
    private final Coverage coverage;

    public HitCounts(int retrievedHits, int summaryCount, long totalHitCount,
                     int requestedHits, int requestedOffset, Coverage coverage)
    {

        this.retrievedHits = retrievedHits;
        this.summaryCount = summaryCount;
        this.totalHitCount = totalHitCount;
        this.requestedHits = requestedHits;
        this.requestedOffset = requestedOffset;
        this.coverage = coverage;
    }

    /**
     * The number of hits returned by the server.
     * Compare to getRequestedHits().
     */
    public int getRetrievedHitCount() {
        return retrievedHits;
    }

    /**
     * The number of hit summaries ("document contents") fetched.
     */
    public int getSummaryCount() {
        return summaryCount;
    }

    /**
     * The total number of matching hits
     * for the request.
     */
    public long getTotalHitCount() {
        return totalHitCount;
    }

    /**
     * The number of hits requested by the user.
     * Compare to getRetrievedHitCount().
     */
    public int getRequestedHits() {
        return requestedHits;
    }

    /**
     * The user requested offset into the linear mapping of the result space.
     */
    public int getRequestedOffset() {
        return requestedOffset;
    }

    public Coverage getCoverage() { return coverage; }

}