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 Bing Li <lb...@gmail.com> on 2011/01/26 21:19:10 UTC

SolrDocumentList Size vs NumFound

Dear all,

I got a weird problem. The number of searched documents is much more than
10. However, the size of SolrDocumentList is 10 and the getNumFound() is the
exact count of results. When I need to iterate the results as follows, only
10 are displayed. How to get the rest ones?

                ......
                for (SolrDocument doc : docs)
                {

System.out.println(doc.getFieldValue(Fields.CATEGORIZED_HUB_TITLE_FIELD) +
": " + doc.getFieldValue(Fields.CATEGORIZED_HUB_URL_FIELD) + "; " +
doc.getFieldValue(Fields.HUB_CATEGORY_NAME_FIELD) + "/" +
doc.getFieldValue(Fields.HUB_PARENT_CATEGORY_NAME_FIELD));
                }
                ......

Could you give me a hand?

Thanks,
LB

Re: SolrDocumentList Size vs NumFound

Posted by Markus Jelsma <ma...@openindex.io>.
Hi,

If your query yields 1000 documents and the rows parameter is 10 then you'll 
get only 10 documents.  Consult the wiki on the start and rows parameters:

http://wiki.apache.org/solr/CommonQueryParameters

Cheers.

> Dear all,
> 
> I got a weird problem. The number of searched documents is much more than
> 10. However, the size of SolrDocumentList is 10 and the getNumFound() is
> the exact count of results. When I need to iterate the results as follows,
> only 10 are displayed. How to get the rest ones?
> 
>                 ......
>                 for (SolrDocument doc : docs)
>                 {
> 
> System.out.println(doc.getFieldValue(Fields.CATEGORIZED_HUB_TITLE_FIELD) +
> ": " + doc.getFieldValue(Fields.CATEGORIZED_HUB_URL_FIELD) + "; " +
> doc.getFieldValue(Fields.HUB_CATEGORY_NAME_FIELD) + "/" +
> doc.getFieldValue(Fields.HUB_PARENT_CATEGORY_NAME_FIELD));
>                 }
>                 ......
> 
> Could you give me a hand?
> 
> Thanks,
> LB