private Item replaceTerms(Query q, IndexFacts.Session indexFacts) {
        Language language = q.getModel().getParsingLanguage();
        if (language == Language.UNKNOWN) {
            q.trace("Language is unknown, not stemming", 3);
            return q.getModel().getQueryTree().getRoot();
        }

        StemContext context = new StemContext();
        context.isCJK = language.isCjk();
        context.language = language;
        context.indexFacts = indexFacts;
        context.reverseConnectivity = createReverseConnectivities(q.getModel().getQueryTree().getRoot());
        if (q.getTrace().getLevel() >= 3)
            q.trace("Stemming with language " + language + " using " + linguistics, 3);
        return scan(q.getModel().getQueryTree().getRoot(), context);
    }
Replaces query terms with their stems

@author Mathias Lidal
@author bratseth
@author Steinar Knutsen
container-search/src/main/java/com/yahoo/prelude/querytransform/StemmingSearcher.java