Remove NextPath from Iterator interface
NextPath is one of the weird hacks that remain in Cayley from old days. It was added to make HasA iterator work properly, but in fact it can be hidden under the flag of HasA iterator.
HasA allows to either iterate over unique nodes that can be found on a specific direction of a quad, or iterate over duplicate nodes in this direction, but also "touch" other paths that can lead to this node.
It always leads to confusion in planner and query optimizer, because it cannot be quite sure if user will call one branch or the other, while backend could in theory build two optimal queries for each case.
It also getting worse when tags are defined on the query tree. It might be optimal to flip the flag on HasA to disable duplicates if no tags are defined in subtree, but again, user may decide to call NextPath anyway and break this optimization.
Splitting an iterator into two, or defining a new option for it will fix an issue and allow to properly optimize these query types. It will also lead to cleaner code.
@dennwc is this part of the iterators refactor planned for this version?