Metadata Search Results Total Count?
I've implemented the Metadata Search API, but was curious if there is a way to get the Total Count of search results even though I am paginating 100 results at a time. I understand using the marker, for pagination, but would like to be able to display the total number of results so I can display "Showing item 1-100 of 2500" or something similar.
Thanks!
-
Hi - I assume you're using this API endpoint - https://developer.box.com/reference/post-metadata-queries-execute-read/
If so, the only way to get the total number of items is to page through all the results. I'll spare the details but suffice it to say that this is a tradeoff we have had to make to ensure that we can support queries for templates with very large instance counts and/or very large result sets.
Depending on how many results you have, a few things that might help here:
-You can order your results, so if the goal is to get a user closer to the record(s) of interest on the first page, that may be an option
-You may consider implementing something on the client side to provide a page count or at least approximate it. For example - fetch the first 50 records and start to render the page/items. While that's going on, continue to fetch more results until you reach some breakover point - e.g. 500 records. Then for counts under 500, you can show "1-50 of n" - for counts over 500, you could show "1-50 of 500+" - of course you can adjust your values depending on the use case.
Can you elaborate on the specific reasons behind your desire to show a total count of items? I've heard various reasons so am just trying to get a better understanding of all of them.
サインインしてコメントを残してください。
コメント
1件のコメント