private static boolean hasRankItem(Item root) {
        Deque<Item> stack = new ArrayDeque<>();
        stack.push(root);
        while (!stack.isEmpty()) {
            Item item = stack.pop();
            if (item instanceof RankItem) {
                return true;
            }
            if (item instanceof CompositeItem lst) {
                for (Iterator<Item> it = lst.getItemIterator(); it.hasNext();) {
                    stack.push(it.next());
                }
            }
        }
        return false;
    }
Returns true if the given item tree contains at least one instance of {@link RankItem}.

@param root The root of the tree to check.
@return True if a rank item was found.
container-search/src/main/java/com/yahoo/prelude/querytransform/RecallSearcher.java