Sorting by rank instead of score value.

Rank is set by sorting all records by score value anyway. This fix
avoids confusion when multiple entries have the same score, but don’t
appear in the right rank order.