Rank output

Rank output provides query, rank, score, target.

There my be a better way of doing this using best or tail, but it didn't immediately jump out at me.