Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

johndoe5's avatar
johndoe5
Explorer | Level 3
5 years ago
Solved

search_v2: has_more=true even though there're no more results

I have a directory a, with one sub directory, which contains another subdirectory. Each directory contains an image file with a ".jpg" extension (so three images in total).

When I create a search query for ".jpg" inside the folder a with max_results=3, I get a response with exactly three results. But has_more equals true. When I use the returned cursor in a request to /files/search/continue_v2, an empty result is returned with has_more=false.

I would expect the API to return has_more=false on the very first request, since there are no more results.

When I change the max_results parameter of the initial search request to 4, the response contains all (three) results and has_more=false.

Is this behaviour intended?

  • Hi johndoe5,

    Since Dropbox API is asynchronous, if not explicitly pointed out something else for particular call, you can't rely on any particular result. Any possible result, described in documentation, is... possible! So you must not assume anything, but strictly follow the API description. At the point, you have described, possibly there wasn't enough time to ongoing procedure gets to the end and it assumes there are other entries (even though there are not). That's it.

    Hope this clarifies matter.

2 Replies

  • Здравко's avatar
    Здравко
    Legendary | Level 20
    5 years ago

    Hi johndoe5,

    Since Dropbox API is asynchronous, if not explicitly pointed out something else for particular call, you can't rely on any particular result. Any possible result, described in documentation, is... possible! So you must not assume anything, but strictly follow the API description. At the point, you have described, possibly there wasn't enough time to ongoing procedure gets to the end and it assumes there are other entries (even though there are not). That's it.

    Hope this clarifies matter.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    5 years ago

    johndoe5 Здравко is correct, the page size of a result from /2/files/search_v2 and /2/files/search/continue_v2 is not guaranteed, and may be empty in some cases like this, due to how the Dropbox search functionality works. Your app should be written to call back if 'has_more' is true, but be able to handle empty 'matches' lists.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,038 PostsLatest Activity: 13 hours ago
415 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!