Solr query always returning first 10 rows

Anu picture Anu · May 8, 2012 · Viewed 8k times · Source

I have implemented Solr search in one of my .net application. Everything working fine except whenever I try to use the Solr's search functionalities, it's returning only 10 results, while I have more than 100 documents indexed. Can anyone please tell me how can I fixed this issue?

Some examples that demonstrate are:

http://117.55.242.204:8983/solr/select/?q=:&start=0&rows=10

returning 10 rows.

http://117.55.242.204:8983/solr/select/?q=.&start=20&rows=30

returning 0 rows but showing numFound 10.

Answer

Ansari picture Ansari · May 8, 2012

You have to pay attention to two variables here: start and rows.

In the first case, it is only returning 10 documents because rows is 10. In the second case, it is trying to return documents 21 through 30 (start is 20 and rows is 10) but there are only 10 matching documents so it's returning zero.

If you want all your documents to be returned, set rows to a high value like 1000 or 10000 or the number of documents in your index. If you're not paging, make sure start is set to 0.