public void ensureNotInSubtree(CompositeItem item) {
        for (Item i = this; i != null; i = i.getParent()) {
            if (i == item) {
                throw new IllegalArgumentException("Cannot add '" + item + "' to '" + this + "' as it would create a cycle");
            }
        }
    }
Sets the index name of all subitems of this
container-search/src/main/java/com/yahoo/prelude/query/CompositeItem.java