public int compare(PhraseMatcher.Phrase phrase1, PhraseMatcher.Phrase phrase2) {
            if ((phrase2.getLength()>phrase1.getLength()) ||
               (phrase2.getLength()==phrase1.getLength() &&
                phrase2.getStartIndex()<=phrase1.getStartIndex())) {
                return 1;
            } else {
                return -1;
            }
        }
Class for comparing phrase.
A phrase is larger if its length is longer.
If both phrases are of the same length, the lefter one
is considered larger
container-search/src/main/java/com/yahoo/search/query/rewrite/RewriterFeatures.java