private void lowerCase(WeightedSetItem set, IndexFacts.Session indexFacts) {
        if ( ! syntheticLowerCaseCheck(set.getIndexName(), indexFacts, true)) {
            return;
        }

        List<WeightedSetToken> terms = new ArrayList<>(set.getNumTokens());
        for (Iterator<Map.Entry<Object, Integer>> i = set.getTokens(); i.hasNext();) {
            Map.Entry<Object, Integer> e = i.next();
            if (e.getKey() instanceof String) {
                String originalToken = (String) e.getKey();
                String token = toLowerCase(originalToken);
                if ( ! originalToken.equals(token)) {
                    terms.add(new WeightedSetToken(token, originalToken, e.getValue().intValue()));
                }
            }
        }
        // has to do it in two passes on cause of the "interesting" API in
        // weighted set, and remove before put on cause of the semantics of
        // addInternal as well as changed values...
        for (WeightedSetToken t : terms) {
            set.removeToken(t.originalToken);
            set.addToken(t.token, t.weight);
        }
    }
Traverse a query tree and lowercase terms based on decision made in subclasses.

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