blob: bd5377183bf36c8763b3d6fe1bb5571bc351aed0 (
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
|
// 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 <vector>
namespace search::features {
class ValueExecutor final : public fef::FeatureExecutor
{
private:
std::vector<feature_t> _values;
public:
ValueExecutor(const std::vector<feature_t> & values);
bool isPure() override { return true; }
void execute(uint32_t docId) override;
const std::vector<feature_t> & getValues() const { return _values; }
};
class SingleValueExecutor final : public fef::FeatureExecutor
{
private:
feature_t _value;
public:
SingleValueExecutor(feature_t value) : _value(value) { }
bool isPure() override { return true; }
void execute(uint32_t docId) override;
};
class SingleZeroValueExecutor final : public fef::FeatureExecutor
{
public:
SingleZeroValueExecutor() : FeatureExecutor() {}
bool isPure() override { return true; }
void execute(uint32_t docId) override;
};
class ValueBlueprint : public fef::Blueprint
{
private:
std::vector<feature_t> _values;
public:
ValueBlueprint();
~ValueBlueprint();
void visitDumpFeatures(const fef::IIndexEnvironment & indexEnv,
fef::IDumpFeatureVisitor & visitor) const override;
fef::Blueprint::UP createInstance() const override { return Blueprint::UP(new ValueBlueprint()); }
fef::ParameterDescriptions getDescriptions() const override {
return fef::ParameterDescriptions().desc().number().number().repeat();
}
bool setup(const fef::IIndexEnvironment & env,
const fef::ParameterList & params) override;
fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &queryEnv, vespalib::Stash &stash) const override;
};
}
|