aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/main/java/com/yahoo/searchlib/ranking/features/Features.java
blob: ee8f22b2e36a82f7facf4ba49699e90975536c3c (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.searchlib.ranking.features;

import com.yahoo.api.annotations.Beta;
import com.yahoo.searchlib.rankingexpression.evaluation.Value;

import java.util.Collections;
import java.util.Map;

/**
 * A set of (immutable) computed features
 *
 * @author bratseth
 */
@Beta
public class Features {

    private Map<String, Value> features;

    /** Creates a set of features by assigning ownership of map of features to this */
    Features(Map<String, Value> features) {
        this.features = Collections.unmodifiableMap(features);
    }

    /** Returns the Value of a feature, or null if it is not present in this */
    public Value get(String featureName) {
        return features.get(featureName);
    }

}