int calculateMatchDigest(ProductionRule rule) {
        int matchDigest = rule.hashCode();
        int matchCounter = 1;
        for (ReferencedMatches matches : referencedMatchesList) {
            int termCounter = 0;
            for (Iterator<Match> j = matches.matchIterator(); j.hasNext(); ) {
                Match match = j.next();
                matchDigest = 7 * matchDigest * matchCounter +
                        71 * termCounter +
                        match.hashCode();
                termCounter++;
            }
            matchCounter++;
        }
        for (Match match : nonreferencedMatches) {
            matchDigest = 7 * matchDigest * matchCounter + match.hashCode();
            matchCounter++;
        }
        return matchDigest;
    }
<p>Calculates an id which is unique for each match (the totality of the matched terms)
to a high probability. Why can we not simply look at the position
of terms? Because rules are allowed to modify the query tree in ways that makes positions
change.</p>

<p>This digest is also problematic, because it's really the matching condition who should
calculate a match digest for that term which incorporates the semantics of that kind
of match (maybe not the word and index, but something else). This is a todo for when
we add other kinds of conditions.</p>
container-search/src/main/java/com/yahoo/prelude/semantics/engine/RuleEvaluation.java