private Item addRankFilter(Item root, Item item) {
        if (item == null) {
            return root;
        }

        if (root instanceof RankItem) {
            ((RankItem) root).addItem(item);
            return root;
        }

        RankItem rank = new RankItem();

        rank.addItem(root);
        rank.addItem(item);
        return rank;
    }
Returns the top level item resulting from combining the given top
level item and the new item. This implements most of the weird transformation
rules of the parser.
container-search/src/main/java/com/yahoo/prelude/query/parser/AnyParser.java