private void addLiterals(RankItem rankTerms, Item item, IndexFacts.Session indexFacts) {
        if (item instanceof NotItem) {
            addLiterals(rankTerms, ((NotItem) item).getPositiveItem(), indexFacts);
        }
        else if (item instanceof CompositeItem) {
            for (Iterator<Item> i = ((CompositeItem)item).getItemIterator(); i.hasNext(); )
                addLiterals(rankTerms, i.next(), indexFacts);
        }
        else if (item instanceof TermItem) {
            TermItem termItem = (TermItem)item;
            Index index = indexFacts.getIndex(termItem.getIndexName());
            if (index.getLiteralBoost())
                rankTerms.addItem(new WordItem(toLowerCase(termItem.getRawWord()), index.getName() + "_literal"));
        }
    }
Adds a RankItem at the root of a query, but only if there is
at least one rank term in the specified RankItem.
If the root is already a RankItem, just append the new rank terms.

@param rankTerms the new rank item to add.
@param query the query to add to
container-search/src/main/java/com/yahoo/prelude/querytransform/LiteralBoostSearcher.java