You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by John DeRosa <jo...@ipstreet.com> on 2010/07/30 19:39:03 UTC

Programmatically retrieving numDocs (or any other statistic)

I want to programmatically retrieve the number of indexed documents. I.e., get the value of numDocs.

The only two ways I've come up with are searching for "*:*" and reporting the hit count, or sending an Http GET to http://xxx.xx.xxx.xxx:8080/solr/admin/stats.jsp#core and searching for <stat name="numDocs" >xxxx </stat> in the response.

Both seem to be overkill. Is there an easier way to ask SolrIndexSearcher, "what's numDocs"?

(I'm doing this in Python, using Pysolr, if that matters.)

Thanks!


Re: Programmatically retrieving numDocs (or any other statistic)

Posted by Chris Hostetter <ho...@fucit.org>.
: I want to programmatically retrieve the number of indexed documents. I.e., get the value of numDocs.

Index level stats like this can be fetched from the LukeRequestHandler in 
any recent version of SOlr...
	http://localhost:8983/solr/admin/luke?numTerms=0

In future releases (ie: already in trunk and branch 3x) there is also the 
SolrInfoMBeanRequestHandler which will replace registry.jsp and stats.jsp 

https://issues.apache.org/jira/browse/SOLR-1750


-Hoss


Re: Programmatically retrieving numDocs (or any other statistic)

Posted by John DeRosa <jo...@ipstreet.com>.
Thanks!

On Jul 30, 2010, at 1:11 PM, Peter Karich wrote:

> Both approaches are ok, I think. (although I don't know the python API)
> BTW: If you query q=*:* then add rows=0 to avoid some traffic.
> 
> Regards,
> Peter.
> 
>> I want to programmatically retrieve the number of indexed documents. I.e., get the value of numDocs.
>> 
>> The only two ways I've come up with are searching for "*:*" and reporting the hit count, or sending an Http GET to http://xxx.xx.xxx.xxx:8080/solr/admin/stats.jsp#core and searching for <stat name="numDocs" >xxxx </stat> in the response.
>> 
>> Both seem to be overkill. Is there an easier way to ask SolrIndexSearcher, "what's numDocs"?
>> 
>> (I'm doing this in Python, using Pysolr, if that matters.)
>> 
>> Thanks!


Re: Programmatically retrieving numDocs (or any other statistic)

Posted by Peter Karich <pe...@yahoo.de>.
Both approaches are ok, I think. (although I don't know the python API)
BTW: If you query q=*:* then add rows=0 to avoid some traffic.

Regards,
Peter.

> I want to programmatically retrieve the number of indexed documents. I.e., get the value of numDocs.
>
> The only two ways I've come up with are searching for "*:*" and reporting the hit count, or sending an Http GET to http://xxx.xx.xxx.xxx:8080/solr/admin/stats.jsp#core and searching for <stat name="numDocs" >xxxx </stat> in the response.
>
> Both seem to be overkill. Is there an easier way to ask SolrIndexSearcher, "what's numDocs"?
>
> (I'm doing this in Python, using Pysolr, if that matters.)
>
> Thanks!

Re: Programmatically retrieving numDocs (or any other statistic)

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I suppose you could write a component that just gets this info from 
SolrIndexSearcher and write that in the response?

Otis
----
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch
Lucene ecosystem search :: http://search-lucene.com/



----- Original Message ----
> From: John DeRosa <jo...@ipstreet.com>
> To: solr-user@lucene.apache.org
> Sent: Fri, July 30, 2010 1:39:03 PM
> Subject: Programmatically retrieving numDocs (or any other statistic)
> 
> I want to programmatically retrieve the number of indexed documents. I.e., get  
>the value of numDocs.
> 
> The only two ways I've come up with are searching  for "*:*" and reporting the 
>hit count, or sending an Http GET to 
>http://xxx.xx.xxx.xxx:8080/solr/admin/stats.jsp#core and searching for  <stat 
>name="numDocs" >xxxx </stat> in the response.
> 
> Both seem  to be overkill. Is there an easier way to ask SolrIndexSearcher, 
>"what's  numDocs"?
> 
> (I'm doing this in Python, using Pysolr, if that  matters.)
> 
> Thanks!
> 
>