The query for *:* with rows=0 is only for the initial startup. When there's
search query and filter, these need to be added in to the query as we
wanted to display the total number of records in each of the collections
with respect to the query and filter.

Regards,
Edwin


On 5 June 2015 at 21:14, Shawn Heisey <apa...@elyograg.org> wrote:

> On 6/5/2015 7:00 AM, Upayavira wrote:
> > I'm not so sure this is as bad as it sounds. When your collection is
> > sharded, no single node knows about the documents in other shards/nodes,
> > so to find the total number, a query will need to go to every node.
> >
> > Trying to work out something to do a single request to every node,
> > combine their collection statistics and aggregate them into a single
> > result sounds very complicated, and likely overkill.
> >
> > Are you needing to collect this information often? Do you have a lot of
> > collections?
>
> A query for *:* with rows=0 is quite fast on any Solr version, unless
> RAM is too tight.  If your commits are infrequent, subsequent queries
> for that information will even faster because they will be served from
> Solr caches.
>
> There's no reason to have user code talk to all the shards and aggregate
> the document count for the collection -- let SolrCloud handle it and
> just query the collection with q=*:*&rows=0.  The numFound value in the
> response will cover the entire collection, and Solr will optimize the
> query as much as it possibly can be optimized.
>
> Thanks,
> Shawn
>
>

Reply via email to