Remove N+1 query from search controller