Add search sorting support.

This adds a SearchSorted function which will return the search for given
results and then sort them based on a passed in value.