On 5/1/2012 8:57 AM, Rahul R wrote:
Hello,
A related question on this topic. How do I programmatically find the total
number of documents across many shards ? For EmbeddedSolrServer, I use the
following command to get the total count :
solrSearcher.getStatistics().get("numDocs")

With distributed search, how do i get the count of all records in all
shards. Apart from doing a *:* query, is there a way to get the total count
? I am not able to use the same command above because, I am not able to get
a handle to the SolrIndexSearcher object with distributed search. The conf
and data directories of my index reside directly under a folder called solr
(no core) under the weblogic domain directly. I dont have a SolrCore
object. With EmbeddedSolrServer, I used to get the SolrIndexSearcher object
using the following call :
solrSearcher = (SolrIndexSearcher)SolrCoreObject.getSearcher().get();

A *:* query with rows=0 is how I get a total document count. The program that does this most often is Perl using LWP, but I'm pretty sure I could do the same thing with the Commons server in SolrJ. I've never used the embedded server. I do not specify the shards parameter on my requests, I query a special core that has the shards parameter in solrconfig.xml.

Thanks,
Shawn

Reply via email to