blob: a5c397cea8a9743d6157a43790f1a865bcc0097e (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "expression_replacer.h"
namespace search::features::rankingexpression {
ExpressionReplacer::~ExpressionReplacer()
{
}
//-----------------------------------------------------------------------------
IntrinsicExpression::UP
NullExpressionReplacer::maybe_replace(const vespalib::eval::Function &,
const search::fef::IIndexEnvironment &) const
{
return IntrinsicExpression::UP(nullptr);
}
NullExpressionReplacer::~NullExpressionReplacer()
{
}
//-----------------------------------------------------------------------------
ListExpressionReplacer::ListExpressionReplacer() = default;
void
ListExpressionReplacer::add(ExpressionReplacer::UP replacer)
{
_list.push_back(std::move(replacer));
}
IntrinsicExpression::UP
ListExpressionReplacer::maybe_replace(const vespalib::eval::Function &function,
const search::fef::IIndexEnvironment &env) const
{
for (const auto &item: _list) {
if (auto result = item.get()->maybe_replace(function, env)) {
return result;
}
}
return IntrinsicExpression::UP(nullptr);
}
ListExpressionReplacer::~ListExpressionReplacer()
{
}
} // namespace search::features::rankingexpression
|