fixed search count for group by queries