hitsPerPage
20
'hitsPerPage' => number_of_hits
Can be used in these methods:
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
search,
set_settings,
browse_objects,
generate_secured_api_key,
add_api_key,
update_api_key
search,
setSettings,
browse,
generateSecuredApiKey,
addAPIKey,
updateAPIKey
search,
setSettings,
browseObjects,
generateSecuredApiKey,
addApiKey,
updateApiKey
searchAsync,
setSettingsAsync,
browseAsync
Search,
SetSettings,
Browse,
GenerateSecuredApiKey,
AddApiKey,
UpdateApiKey
Search,
setSettings,
browse,
generateSecuredApiKey,
addApiKey,
updateApiKey
Search,
SetSettings,
BrowseObjects,
GenerateSecuredAPIKey,
AddAPIKey,
UpdateAPIKey
search,
setSettings,
browse index,
generateSecuredApiKey,
add key,
update key
About this parameter
Set the number of hits per page.
In most cases, page
/hitsPerPage
is the recommended method for pagination.
Check our full discussion on pagination approaches.
Usage notes:
-
This can be set at indexing time, as a default. And can be overridden at query time.
-
1000 is the maximum.
Examples
Set default number of hits per page
1
2
3
$index->setSettings([
'hitsPerPage' => 20
]);
Override default number of hits per page for the current search
1
2
3
$results = $index->search('query', [
'hitsPerPage' => 10
]);