Implement search result sorting.