add explicit ORDER BY clause to the search APIs query. (fixes #3676)