API Reference / API Parameters / hitsPerPage
Type: integer
Engine default: 20
Parameter syntax
'hitsPerPage' => number_of_hits

Can be used in these methods:

About this parameter

Set the number of hits per page for paginating the search results.

Algolia uses the page and hitsPerPage parameters to control how search results are displayed (paginated).

  • hitsPerPage: sets the number of search results (hits) displayed per page. Choose a value between 1 and 1,000. The default is 20.
  • page: specifies the page number of the search results you want to retrieve. Page numbering starts at 0, so the first page is page=0, the second is page=1, and so on.

For example, to display 10 results per page starting from the third page, set hitsPerPage to 10 and page to 2.

Usage notes

  • This is set at indexing time.
  • Setting can be overridden at query time.

Examples

Set default number of hits per page

1
2
3
$index->setSettings([
  'hitsPerPage' => 20
]);
1
2
3
$results = $index->search('query', [
  'hitsPerPage' => 10
]);
Did you find this page helpful?