eliminate N+1 queries on search