blob: 685e65b17693ba8abfa8b01434cd4007d49591d2 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "featureexecutor.h"
namespace search::fef {
/**
* A Feature Overrider is a simple decorator class that wraps a single
* Feature Executor instance and overrides one of its output
* features. All method invocations are passed through to the inner
* feature executor. Each time the execute method is invoked, the
* appropriate feature value is overwritten.
**/
class FeatureOverrider : public FeatureExecutor
{
private:
using Value = vespalib::eval::Value;
FeatureExecutor & _executor;
uint32_t _outputIdx;
feature_t _number;
Value::UP _object;
virtual void handle_bind_match_data(const MatchData &md) override;
virtual void handle_bind_inputs(vespalib::ConstArrayRef<LazyValue> inputs) override;
virtual void handle_bind_outputs(vespalib::ArrayRef<NumberOrObject> outputs) override;
public:
FeatureOverrider(const FeatureOverrider &) = delete;
FeatureOverrider &operator=(const FeatureOverrider &) = delete;
FeatureOverrider(FeatureExecutor &executor, uint32_t outputIdx, feature_t number, Value::UP object);
bool isPure() override;
void execute(uint32_t docId) override;
};
}
|