summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Brede Vekterli <vekterli@vespa.ai>2024-03-12 13:52:39 +0000
committerTor Brede Vekterli <vekterli@vespa.ai>2024-03-12 13:52:39 +0000
commit89e2adfc2b268b33b9c25ef18bc32bfed9d5e838 (patch)
treefdb0aa37c48b28aa5efa66699c7fbb93a5a86e35
parent278b41261d6487fa62e2c777b170e7a69edf4af1 (diff)
Trace children of branching selection nodes, not just their result
Otherwise an evaluation trace of e.g. a conjunctive expression will only observe the _result_ of the `and` node's lhs/rhs children, not the actual sub traces of evaluating them.
-rw-r--r--document/src/vespa/document/select/branch.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/document/src/vespa/document/select/branch.cpp b/document/src/vespa/document/select/branch.cpp
index 02f767c96b5..6035b5fe9a0 100644
--- a/document/src/vespa/document/select/branch.cpp
+++ b/document/src/vespa/document/select/branch.cpp
@@ -39,6 +39,10 @@ namespace {
ResultList traceAndValue(const T& value, std::ostream& out,
const Node& leftNode, const Node& rightNode)
{
+ out << "And (lhs):\n";
+ (void)leftNode.trace(value, out);
+ out << "And (rhs):\n";
+ (void)rightNode.trace(value, out);
out << "And - Left branch returned " << leftNode.contains(value) << ".\n";
out << "And - Right branch returned " << rightNode.contains(value) << ".\n";
return leftNode.contains(value) && rightNode.contains(value);
@@ -83,6 +87,10 @@ namespace {
ResultList traceOrValue(const T& value, std::ostream& out,
const Node& leftNode, const Node& rightNode)
{
+ out << "Or (lhs):\n";
+ (void)leftNode.trace(value, out);
+ out << "Or (rhs):\n";
+ (void)rightNode.trace(value, out);
out << "Or - Left branch returned " << leftNode.contains(value) << ".\n";
out << "Or - Right branch returned " << rightNode.contains(value) << ".\n";
return leftNode.contains(value) || rightNode.contains(value);
@@ -122,6 +130,8 @@ namespace {
template<typename T>
ResultList traceNotValue(const T& value, std::ostream& out, const Node& node)
{
+ out << "Not:\n";
+ (void)node.trace(value, out);
out << "Not - Child returned " << node.contains(value)
<< ". Returning opposite.\n";
return !node.contains(value);