aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/features/item_raw_score_feature.h
blob: eb2deb762f3ecf33cb1a561a38eb6091639e15ff (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/fef/blueprint.h>

namespace search::features {

class ItemRawScoreExecutor : public fef::FeatureExecutor
{
public:
    using HandleVector = std::vector<fef::TermFieldHandle>;
private:
    HandleVector _handles;
    const fef::MatchData *_md;

    void handle_bind_match_data(const fef::MatchData &md) override;

public:
    ItemRawScoreExecutor(HandleVector handles)
        : FeatureExecutor(), _handles(handles), _md(nullptr) {}
    void execute(uint32_t docId) override;
};

class SimpleItemRawScoreExecutor : public fef::FeatureExecutor
{
private:
    fef::TermFieldHandle _handle;
    const fef::MatchData *_md;

    void handle_bind_match_data(const fef::MatchData &md) override;

public:
    SimpleItemRawScoreExecutor(fef::TermFieldHandle handle)
        : FeatureExecutor(), _handle(handle), _md(nullptr) {}
    void execute(uint32_t docId) override;
};


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

class ItemRawScoreBlueprint : public fef::Blueprint
{
private:
    using HandleVector = std::vector<fef::TermFieldHandle>;
    vespalib::string _label;
public:
    ItemRawScoreBlueprint() : Blueprint("itemRawScore"), _label() {}
    ~ItemRawScoreBlueprint() override;
    void visitDumpFeatures(const fef::IIndexEnvironment &, fef::IDumpFeatureVisitor &) const override {}
    fef::Blueprint::UP createInstance() const override {
        return Blueprint::UP(new ItemRawScoreBlueprint());
    }
    fef::ParameterDescriptions getDescriptions() const override {
        return fef::ParameterDescriptions().desc().string();
    }
    bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList &params) override;
    fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;

    static HandleVector resolve(const fef::IQueryEnvironment &env, const vespalib::string &label);
};

}