Anonymous12345 Anonymous12345 - 2 months ago 11
Java Question

How to manage "paging" with Solr?

I have a classifieds website...
I have Solr doing the searching of the classifieds, and then return ID:nrs which I then use to put into an array. Then I use this array to find any classifieds in a MySql db where the ID:s match the ID:s in the array returned by Solr.

Now, because this array can be very very big (100thousand records or more) then I would need to "page" the results so that maybe 100 where returned at a time. And then use those 100 ID:s in MySql to find the classifieds.

So, is it possible to page with SOLR?

And if so, how? I need example code... And what the results would be please.

Mostly I need a thorough example!

Thanks

Answer

Take a look at IBM. Maybe that will get you on the right course.

Number of results: Specifies the maximum number of results to return.

Start: The offset to start at in the result set. This is useful for pagination.

So you probably want some variation on

<str name="rows">10</str>
<str name="start">0</str>

Your solr client should provide some way to get the total number of results without much trouble.

Comments