Calculating Total Pages in Search Request Results
TLDR Laura asked how to calculate total pages of search results. Jason suggested using found / per_page
.
Powered by Struct AI

4
3mo
Solved
Jun 09, 2023 (3 months ago)
Laura
Laura
05:21 PMIs it possible for my search request to return the total pages of my results? I realized that the request returns the total of items and the current page, but to dentify in my front end the page I am on I need to implement some logic with the total of products and the page I am on?
Jason
Jason
05:22 PMIf you do
found / per_page
you should get the total number of pages05:22
Jason
05:22 PMper_page
is a search parameter that defaults to 10
Laura
Laura
05:25 PMThanks! I understood now

Typesense
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
Indexed 2764 threads (79% resolved)
Similar Threads
Pagination and Determining Next Page
Gustavo asked about pagination and determining the next page. Jason suggested using the `found`, `per_page`, and `page` keys to calculate the total number of pages.
4
3mo
Solved
Identifying Last Page of Search Results via API
TJ asked if there was a way to know when he's reached the last page of a search result. Jason suggested using the 'found' and 'page' parameters in the API response.

4
2mo
Solved
Query about Search API's Result Details
Shawn asked if the search API returns total pages. Jason clarified that it does not, yet it provides data necessary for the calculation.

4
8mo
Solved