From 89e2adfc2b268b33b9c25ef18bc32bfed9d5e838 Mon Sep 17 00:00:00 2001 From: Tor Brede Vekterli Date: Tue, 12 Mar 2024 13:52:39 +0000 Subject: 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. --- document/src/vespa/document/select/branch.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 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); -- cgit v1.2.3