aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/fef/ranking_assets_repo.h
blob: 4e613f4bffb138ab105c10af4cfbffb6f69b727d (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "i_ranking_assets_repo.h"
#include "ranking_constants.h"
#include "onnx_models.h"
#include "ranking_expressions.h"
#include <vespa/eval/eval/value_cache/constant_value.h>

namespace search::fef {

/**
 * Class that provides access to a configured set of rank constant values.
 *
 * This class maps symbolic names to assets used while setting up rank features blueprints.
 * A factory is used to instantiate constant values.
 */
class RankingAssetsRepo : public IRankingAssetsRepo {
private:
    using ConstantValueFactory = vespalib::eval::ConstantValueFactory;

    const ConstantValueFactory &_factory;
    const std::shared_ptr<const RankingConstants>   _constants;
    const std::shared_ptr<const RankingExpressions> _rankingExpressions;
    const std::shared_ptr<const OnnxModels>         _onnxModels;

public:
    RankingAssetsRepo(const ConstantValueFactory &factory,
                      std::shared_ptr<const RankingConstants> constants,
                      std::shared_ptr<const RankingExpressions> expressions,
                      std::shared_ptr<const OnnxModels> models);
    ~RankingAssetsRepo() override;
    vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override;
    vespalib::string getExpression(const vespalib::string &name) const override;
    const OnnxModel *getOnnxModel(const vespalib::string &name) const override;
};

}