private static int countUniqueId(Item tree) {
        int sum = tree.hasUniqueID() ? 1 : 0;
        if (tree instanceof CompositeItem asComposite) {
            for (Iterator<Item> i = asComposite.getItemIterator(); i.hasNext();) {
                sum += countUniqueId(i.next());
            }
        }
        return sum;
    }
Returns a deep copy of this item
container-search/src/main/java/com/yahoo/prelude/query/CompositeItem.java