Skip to content

How To: Paging records with Solr

leptronic edited this page Sep 24, 2014 · 1 revision

Here is an example of how we display page 2 in our portal UI. We display 12 records per page:

https://voyagerdemo.com/daily/cart/#/search?pg=2

Here is the Solr call: https://voyagerdemo.com/daily/solr/v0/select?q=*:*&start=12&rows=12&fl=id,name:[name],format&wt=json&json

You will need 2 parameters: start and rows. Starting on record 12 (start = 12) and getting the next 12 (rows = 12) records. This is page 2 on a screen showing 12 records.

Examples of pages 1-3 below.

Page 1 (start=0): https://voyagerdemo.com/daily/solr/v0/select?q=*:*&start=0&rows=12&fl=id,name:[name],format&wt=json&json

Page 2 (start=12): https://voyagerdemo.com/daily/solr/v0/select?q=*:*&start=12&rows=12&fl=id,name:[name],format&wt=json&json

Page 3 (start=24): https://voyagerdemo.com/daily/solr/v0/select?q=*:*&start=24&rows=12&fl=id,name:[name],format&wt=json&json

Here is a javascript snippet for the variables in the solr call:

var rows = 12; var page = 1; //you will increment/decrement this value when the user pages var start = (page-1) * rows;

Clone this wiki locally