[#1461] remove repeated sort code in package_search
Merge branch '1461-repeated-code-in-package_search'