We have the same issue as Paul.  We currently parse the XML manually to pull 
out the numFound from the response.

Cheers!
Adam



----- Original Message ----
From: Paul Tomblin <ptomb...@xcski.com>
To: solr-user@lucene.apache.org
Sent: Friday, October 2, 2009 2:39:01 PM
Subject: Re: How to access the information from SolrJ

On Fri, Oct 2, 2009 at 3:13 PM, Shalin Shekhar Mangar
<shalinman...@gmail.com> wrote:
> On Fri, Oct 2, 2009 at 8:11 PM, Paul Tomblin <ptomb...@xcski.com> wrote:
>
>> Nope, that just gets you the number of results returned, not how many
>> there could be.  Like I said, if you look at the XML returned, you'll
>> see something like
>> <result name='response' numFound='1251' start='0'>
>> but only 10 <doc> returned.  getNumFound returns 10 in that case, not 1251.
>>
>>
>>
> Nope. Check again. getNumFound will definitely give you 1251.
> SolrDocumentList#size() will give you 10.

I don't have to check again.  I put this log into my query code:
            QueryResponse resp = solrChunkServer.query(query);
            SolrDocumentList docs = resp.getResults();
            LOG.debug("got " + docs.getNumFound() + " documents (or "
+ docs.size() + " if you prefer)");
and I got exactly the same number in both places every single time.  I
can verify from the URL line that the following query:

http://test.xcski.com:8080/solrChunk/nutch/select/?q=test&fq=category:pharma&fq=concept:Discovery&rows=5

has a <result name='response' numFound='95' start='0'> but when I do
the same in SolrJ, docs.getNumFound() returns 5.

144652 [http-8080-14] DEBUG com.lucidityworks.solr.Solr  - got 5
documents (or 5 if you prefer)


-- 
http://www.linkedin.com/in/paultomblin



      

Reply via email to