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

/**
 * This class represents a document summary in a {@link GroupingExpression}. It evaluates to the summary of the input
 * {@link com.yahoo.search.result.Hit} that corresponds to the named summary class.
 *
 * @author Simon Thoresen Hult
 */
public class SummaryValue extends DocumentValue {

    private final String name;

    /**
     * Constructs a new instance of this class, using the default summary class.
     */
    public SummaryValue() {
        super("summary()");
        name = null;
    }

    /**
     * Constructs a new instance of this class.
     *
     * @param summaryName The name of the summary class to assign to this.
     */
    public SummaryValue(String summaryName) {
        super("summary(" + summaryName + ")");
        name = summaryName;
    }

    /**
     * Returns the name of the summary class used to retrieve the hit from the search node.
     *
     * @return The summary name.
     */
    public String getSummaryName() {
        return name;
    }
}