fixed order by error in cg_search to only include tables in order by which are included in the search