private Item simplifyPhrases(Item root) {
        if (root == null) {
            return root;
        }
        else if (root instanceof PhraseItem) {
            return collapsePhrase((PhraseItem)root);
        }
        else if (root instanceof CompositeItem) {
            CompositeItem composite = (CompositeItem)root;
            ListIterator<Item> i = composite.getItemIterator();
            while (i.hasNext()) {
                Item original = i.next();
                Item transformed = simplifyPhrases(original);
                if (original != transformed)
                    i.set(transformed);
            }
            return root;
        }
        else {
            return root;
        }
    }
Make single item phrases in query into single word items.

@author Steinar Knutsen
container-search/src/main/java/com/yahoo/prelude/querytransform/CollapsePhraseSearcher.java