Added sort by field that have multiple values per document.

Closes #2634