Added conditional statistics to the search query to speed things up;