aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp
diff options
context:
space:
mode:
authorHåvard Pettersen <havardpe@oath.com>2021-05-11 12:51:11 +0000
committerHåvard Pettersen <havardpe@oath.com>2021-05-11 17:23:21 +0000
commitd616b8c669db913112f687c16c88386c5430d78b (patch)
treebefd55ccaf17871439dc352bf83cbce7bb1d4d89 /searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp
parent839a6f9a7d1f66937f51db3766a2dfd3e7b90675 (diff)
support functional constants
be more specific about const number values (GDBT trees): is_const -> is_const_double get_const_value -> get_const_double_value Add more generic 'get_const_value' that can also be used for tensor values. Allow it to be called even in the case of parse error, in which case it does not produce a value (same as for non-const sub-expressions).
Diffstat (limited to 'searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp')
-rw-r--r--searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp
index f2a9ee2932f..3445d64c477 100644
--- a/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp
+++ b/searchlib/src/apps/vespa-ranking-expression-analyzer/vespa-ranking-expression-analyzer.cpp
@@ -95,11 +95,11 @@ struct FunctionInfo {
if (node) {
auto lhs_symbol = as<Symbol>(node->lhs());
auto rhs_symbol = as<Symbol>(node->rhs());
- if (lhs_symbol && node->rhs().is_const()) {
- inputs[lhs_symbol->id()].cmp_with.push_back(node->rhs().get_const_value());
+ if (lhs_symbol && node->rhs().is_const_double()) {
+ inputs[lhs_symbol->id()].cmp_with.push_back(node->rhs().get_const_double_value());
}
- if (node->lhs().is_const() && rhs_symbol) {
- inputs[rhs_symbol->id()].cmp_with.push_back(node->lhs().get_const_value());
+ if (node->lhs().is_const_double() && rhs_symbol) {
+ inputs[rhs_symbol->id()].cmp_with.push_back(node->lhs().get_const_double_value());
}
}
}
@@ -108,7 +108,7 @@ struct FunctionInfo {
if (node) {
if (auto symbol = as<Symbol>(node->child())) {
for (size_t i = 0; i < node->num_entries(); ++i) {
- inputs[symbol->id()].cmp_with.push_back(node->get_entry(i).get_const_value());
+ inputs[symbol->id()].cmp_with.push_back(node->get_entry(i).get_const_double_value());
}
}
}