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 solrj <gh...@hotmail.com> on 2009/01/17 12:39:11 UTC

Re: Solrj: Getting response attributes from QueryResponse

Hi, 
    I am new to Solr. I would like to know how to get DocumentId,
InternalDocID and Query from QueryResponse. 

Thanks, 
Gomathi


Mark Ferguson-4 wrote:
> 
> Hello,
> 
> I am trying to get the numFound attribute from a returned QueryResponse
> object, but for the life of me I can't find where it is stored. When I
> view
> a response in XML format, it is stored as an attribute on the response
> node,
> e.g.:
> 
> <result name="response" numFound="207" start="5" maxScore="4.1191907">
> 
> However, I can't find a way to retrieve these attributes (numFound, start
> and maxScore). When I look at the QueryResponse itself, I can see that the
> attributes are being stored somewhere, because the toString method returns
> them. For example, queryResponse.toString() returns:
> 
> {responseHeader={status=0,QTime=139,params={wt=javabin,hl=true,rows=15,version=2.2,fl=urlmd5,start=0,q=java}},response={
> *numFound=1228*,start=03.633028,docs=[SolrDocument[{urlmd5=...
> 
> The problem is that when I call queryResponse.get('response'), all I get
> is
> the list of SolrDocuments, I don't have any other attributes. Am I missing
> something or are these attributes just not publically available? If
> they're
> not, shouldn't they be? Thanks a lot,
> 
> Mark Ferguson
> 
> 

-- 
View this message in context: http://www.nabble.com/Solrj%3A-Getting-response-attributes-from-QueryResponse-tp21097801p21515539.html
Sent from the Solr - User mailing list archive at Nabble.com.