public static void visit(QueryVisitor visitor, Item item) {
        if (item instanceof CompositeItem) {
            if (visitor.visit(item)) {
                CompositeItem composite = (CompositeItem) item;
                for (int i = 0; i < composite.getItemCount(); ++i) {
                    visit(visitor, composite.getItem(i));
                }
            }
        } else {
            visitor.visit(item);
        }
        visitor.onExit();
    }
Invoked when all sub-items have been visited, or immediately after
visit() if there are no sub-items or visit() returned false.
This default implementation does nothing.
container-search/src/main/java/com/yahoo/prelude/query/ToolBox.java