private int countItemsRecursively(Item item) {
        int children = 0;
        if (item instanceof CompositeItem composite) {
            for (ListIterator<Item> i = composite.getItemIterator(); i.hasNext(); ) {
                children += countItemsRecursively(i.next());
            }
        }
        return children + 1;
    }
Returns the total number of items in this query tree.
container-search/src/main/java/com/yahoo/search/query/QueryTree.java