Fix count() when LIMIT is set

Using just a limit in search_params, the limit is not enforced. In helpers.count() num_results always contains the full count. This change forces the use of query.count() when a LIMIT is set.