private static void collapseLevels(CompositeItem composite) {
        if (composite instanceof RankItem || composite instanceof NotItem) {
            collapseLevels(composite, composite.getItemIterator()); // collapse the first item only
        }
        else if (composite instanceof AndItem || composite instanceof OrItem || composite instanceof WeakAndItem) {
            for (ListIterator<Item> i = composite.getItemIterator(); i.hasNext(); )
                collapseLevels(composite, i);
        }
    }
Canonicalize this query

@param item the item to canonicalize
@param parentIterator iterator for the parent of this item, never null
@return result of canonicalization
container-search/src/main/java/com/yahoo/prelude/query/QueryCanonicalizer.java