private int sourceOrderCompare(Hit h1,Hit h2) {
        String h1Source=h1.getSource();
        String h2Source=h2.getSource();

        if (h1Source==null && h2Source==null) return 0;
        if (h1Source==null) return 1; // No source -> last
        if (h2Source==null) return -1; // No source -> last

        if (h1Source.equals(h2Source)) return 0;

        return sourceOrder.indexOf(h1Source)-sourceOrder.indexOf(h2Source);
    }
Creates a source order comparator, with an optional secondary comparator.

@param sourceOrder the sort order of list names. This list gets owned by this and must not be modified
@param secondaryComparator the comparator to use as secondary, or null to use the intrinsic hit order
container-search/src/main/java/com/yahoo/search/pagetemplates/engine/SourceOrderComparator.java