@SuppressWarnings("rawtypes")
    private int compareValues(Object first, Object second, Sorting.AttributeSorter s) {
        if (first == null)
            return second == null ? 0 : -1;
        else if (second == null)
            return 1;

        if (first.getClass().isInstance(second) && first instanceof Comparable) {
            // We now know:
            // Second is of a type which is a subclass of first's type
            // They both implement Comparable
            return s.compare((Comparable)first, (Comparable)second);
        } else {
            return s.compare(first.toString(), second.toString());
        }
    }
Compares hits based on a sorting specification and values
stored in hit fields.0
<p>
When one of the hits has the requested property and the other
has not, the hit containing the property precedes the one
that does not.
<p>
There is no locale based sorting here, as the backend does
not do that either.

@return -1, 0, 1 if first should be sorted before, equal to or after second
container-search/src/main/java/com/yahoo/search/result/FieldComparator.java