lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Tomblin <ptomb...@xcski.com>
Subject Re: How to access the information from SolrJ
Date Fri, 02 Oct 2009 19:39:01 GMT
On Fri, Oct 2, 2009 at 3:13 PM, Shalin Shekhar Mangar
<shalinmangar@gmail.com> wrote:
> On Fri, Oct 2, 2009 at 8:11 PM, Paul Tomblin <ptomblin@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

Mime
View raw message