Added sort in search db calls