[#1461] remove repeated sort code in package_search