Welcome to the new Box Support website. Check out all the details here on what’s changed.

Metadata Search Results Total Count?

New post

Comments

1 comment

  • dandennhardt

    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.

    0
    Comment actions Permalink

Please sign in to leave a comment.