@Override
    public int compare(Hit h1,Hit h2) {
        int relevanceComparison=h2.getRelevance().compareTo(h1.getRelevance());
        if (relevanceComparison!=0) return relevanceComparison;

        return super.compare(h1,h2);
    }
Creates a relevance comparator, with an optional secondary comparator.
If the secondary is null, the intrinsic hit order is used as secondary.
container-search/src/main/java/com/yahoo/search/pagetemplates/engine/RelevanceComparator.java