private void setIDF(Item root, SignificanceModel significanceModel) {
        if (root == null || root instanceof NullItem) return;

        if (root instanceof WordItem wi) {
            if (wi.getDocumentFrequency().isPresent() || wi.hasExplicitSignificance())
                return;

            var word = wi.getWord();
            var documentFrequency = significanceModel.documentFrequency(word.toLowerCase());
            long N                = documentFrequency.corpusSize();
            long nq_i             = documentFrequency.frequency();
            log.log(Level.FINE, () -> "Setting document frequency for " + word + " to {frequency: " + nq_i + ", count: " + N + "}");
            wi.setDocumentFrequency(new DocumentFrequency(nq_i, N));
        } else if (root instanceof CompositeItem ci) {
            for (int i = 0; i < ci.getItemCount(); i++) {
                setIDF(ci.getItem(i), significanceModel);
            }
        }
    }
Sets significance values on word items in the query tree.

@author Marius Arhaug
container-search/src/main/java/com/yahoo/search/significance/SignificanceSearcher.java