Paginating Search Results

The pagination object (pagination) is used to divide search results into multiple pages to make it easier for users to navigate through large sets of data. A common use case is enabling site visitors to view a subset of results per page, with options to navigate to the next or previous set of results. Pagination typically includes options like "items per page", "previous page", and "next page". Alternatively, pagination can be integrated with "infinite scroll" where every scroll loads the next page, typically in mobile view.

The pagination object includes:

  • numItems (mandatory): The number of results to return per page.
  • offset (mandatory): The starting position for results.

Example: Paginate search results

This example shows how you can present paginated search results and set the number of items listed on each page. In this example, the number of items shown on each page is 24, and your visitor will see the first 24 results on the first page.

"pagination": { 
    "numItems": 24, 
    "offset": 0 
} 

To retrieve the next 24 results (numbers 25-48):

"pagination": { 
    "numItems": 24, 
    "offset": 24 
} 

Notes:

  • Available only for Semantic Search.
  • numItems max is 100.
  • numItems + offset must be ≤ totalNumResults.
  • totalNumResults is available in every response.
  • Requests exceeding numItems return an empty response.