Re: How to access the information from SolrJ
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. 2009/10/2 Noble Paul നോബിള് नोब्ळ् noble.p...@corp.aol.com: QueryResponse#getResults()#getNumFound() On Thu, Oct 1, 2009 at 11:49 PM, Paul Tomblin ptomb...@xcski.com wrote: When I do a query directly form the web, the XML of the response includes how many results would have been returned if it hadn't restricted itself to the first 10 rows: For instance, the query: http://localhost:8080/solrChunk/nutch/select/?q=*:*fq=category:mysites returns: response lst name='responseHeader' int name='status'0/int int name='QTime'0/int lst name='params' str name='q'*:*/str str name='fq'category:mysites/str /lst /lst result name='response' numFound='1251' start='0' doc str name='category'mysites/str long name='chunkNum'0/long str name='chunkUrl'http://localhost/Chunks/mysites/0-http___xcski.com_.xml/str str name='concept'Anatomy/str ... The value I'm talking about is in the numFound attribute of the result tag. I don't see any way to retrieve it through SolrJ - it's not in the QueryResponse.getHeader(), for instance. Can I retrieve it somewhere? -- http://www.linkedin.com/in/paultomblin -- - Noble Paul | Principal Engineer| AOL | http://aol.com -- http://www.linkedin.com/in/paultomblin
Re: How to access the information from SolrJ
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. -- Regards, Shalin Shekhar Mangar.
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=testfq=category:pharmafq=concept:Discoveryrows=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
Re: How to access the information from SolrJ
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=testfq=category:pharmafq=concept:Discoveryrows=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
Re: How to access the information from SolrJ
On Sat, Oct 3, 2009 at 1:09 AM, Paul Tomblin ptomb...@xcski.com wrote: 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=testfq=category:pharmafq=concept:Discoveryrows=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) I can tell you for sure that this is not a bug in Solr 1.3 or trunk. I checked the code and it is being set correctly. Moreover, I'm using both in production. The class com.lucidityworks.solr.Solr suggests that you are using Lucid's solr build. Perhaps that has a bug? Can you try this with the Solrj client in the official 1.3 release or even trunk? -- Regards, Shalin Shekhar Mangar.
Re: How to access the information from SolrJ
LucidityWorks.com is my client. The similarity to lucid is purely coincidental - the client didn't even know I was going to choose Solr. I am using Solr trunk, last updated and compiled a few weeks ago. -- Sent from my Palm Prē Shalin Shekhar Mangar wrote: On Sat, Oct 3, 2009 at 1:09 AM, Paul Tomblin lt;ptomb...@xcski.com wrote: 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=testamp;fq=category:pharmaamp;fq=concept:Discoveryamp;rows=5 has a lt;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) I can tell you for sure that this is not a bug in Solr 1.3 or trunk. I checked the code and it is being set correctly. Moreover, I'm using both in production. The class com.lucidityworks.solr.Solr suggests that you are using Lucid's solr build. Perhaps that has a bug? Can you try this with the Solrj client in the official 1.3 release or even trunk? -- Regards, Shalin Shekhar Mangar.
Re: How to access the information from SolrJ
On Fri, Oct 2, 2009 at 5:04 PM, Shalin Shekhar Mangar shalinman...@gmail.com wrote: Can you try this with the Solrj client in the official 1.3 release or even trunk? I did a svn update to 821188 and that seems to have fixed the problem. (The jar files changed from -1.3.0 to -1.4-dev) I guess it's been longer since I did an update than I thought. logs/catalina.out:318916 [http-8080-1] DEBUG com.lucidityworks.solr.Solr - got 138 documents (or 15 if you prefer) Thanks very much. -- http://www.linkedin.com/in/paultomblin
How to access the information from SolrJ
When I do a query directly form the web, the XML of the response includes how many results would have been returned if it hadn't restricted itself to the first 10 rows: For instance, the query: http://localhost:8080/solrChunk/nutch/select/?q=*:*fq=category:mysites returns: response lst name='responseHeader' int name='status'0/int int name='QTime'0/int lst name='params' str name='q'*:*/str str name='fq'category:mysites/str /lst /lst result name='response' numFound='1251' start='0' doc str name='category'mysites/str long name='chunkNum'0/long str name='chunkUrl'http://localhost/Chunks/mysites/0-http___xcski.com_.xml/str str name='concept'Anatomy/str ... The value I'm talking about is in the numFound attribute of the result tag. I don't see any way to retrieve it through SolrJ - it's not in the QueryResponse.getHeader(), for instance. Can I retrieve it somewhere? -- http://www.linkedin.com/in/paultomblin
Re: How to access the information from SolrJ
QueryResponse#getResults()#getNumFound() On Thu, Oct 1, 2009 at 11:49 PM, Paul Tomblin ptomb...@xcski.com wrote: When I do a query directly form the web, the XML of the response includes how many results would have been returned if it hadn't restricted itself to the first 10 rows: For instance, the query: http://localhost:8080/solrChunk/nutch/select/?q=*:*fq=category:mysites returns: response lst name='responseHeader' int name='status'0/int int name='QTime'0/int lst name='params' str name='q'*:*/str str name='fq'category:mysites/str /lst /lst result name='response' numFound='1251' start='0' doc str name='category'mysites/str long name='chunkNum'0/long str name='chunkUrl'http://localhost/Chunks/mysites/0-http___xcski.com_.xml/str str name='concept'Anatomy/str ... The value I'm talking about is in the numFound attribute of the result tag. I don't see any way to retrieve it through SolrJ - it's not in the QueryResponse.getHeader(), for instance. Can I retrieve it somewhere? -- http://www.linkedin.com/in/paultomblin -- - Noble Paul | Principal Engineer| AOL | http://aol.com