#community-help

Query about Search API's Result Details

TLDR Shawn asked if the search API returns total pages. Jason clarified that it does not, yet it provides data necessary for the calculation.

Powered by Struct AI

2

4
9mo
Solved
Join the chat
Jan 19, 2023 (9 months ago)
Shawn
Photo of md5-acabeb270eee485e29143a208813eecc
Shawn
04:00 PM
When doing a search on a collection does it return the total pages. For example if I have 42 documents found and I have 20 per page it would be 3 pages in total. Does the api return this value? or do you have to calculate this youself? LMK thanks
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
04:02 PM
The search API returns a found parameter which is the total number of results founds. Using that, and the per_page parameter (which defaults to 10) you should be able to calculate the total number of pages
Shawn
Photo of md5-acabeb270eee485e29143a208813eecc
Shawn
04:03 PM
Yeah that's what I am doing now. It would be nice if the api just provide that value.

1

04:03
Shawn
04:03 PM
Thanks Jason.

1