aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/features/rankingexpressionfeature.h
blob: a759c7855d655e60a25b8df352bc3c04dad21030 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/searchlib/fef/blueprint.h>
#include <vespa/eval/eval/fast_forest.h>
#include <vespa/eval/eval/interpreted_function.h>
#include <vespa/eval/eval/llvm/compile_cache.h>
#include <vespa/searchlib/features/rankingexpression/expression_replacer.h>
#include <vespa/searchlib/features/rankingexpression/intrinsic_expression.h>

namespace search::features {

//-----------------------------------------------------------------------------

/**
 * Implements the blueprint for ranking expression.
 */
class RankingExpressionBlueprint : public fef::Blueprint
{
private:
    rankingexpression::ExpressionReplacer::SP  _expression_replacer;
    rankingexpression::IntrinsicExpression::UP _intrinsic_expression;
    vespalib::eval::gbdt::FastForest::UP       _fast_forest;
    vespalib::eval::InterpretedFunction::UP    _interpreted_function;
    vespalib::eval::CompileCache::Token::UP    _compile_token;
    std::vector<char>                          _input_is_object;
    bool                                       _should_unbox;

public:
    RankingExpressionBlueprint();
    RankingExpressionBlueprint(rankingexpression::ExpressionReplacer::SP replacer);
    ~RankingExpressionBlueprint() override;

    void visitDumpFeatures(const fef::IIndexEnvironment &env, fef::IDumpFeatureVisitor &visitor) const override;
    fef::Blueprint::UP createInstance() const override;
    fef::ParameterDescriptions getDescriptions() const override {
        return fef::ParameterDescriptions().
            desc().
            desc().string();
    }

    bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override;
    void prepareSharedState(const fef::IQueryEnvironment & queryEnv, fef::IObjectStore & objectStore) const override;
    fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;
};

}