cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

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

johndoe5
Explorer | Level 3
Go to solution

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?

1 Accepted Solution

Accepted Solutions

Здравко
Legendary | Level 20
Go to solution

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.

View solution in original post

2 Replies 2

Здравко
Legendary | Level 20
Go to solution

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
Dropbox Staff
Go to solution

@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.

Need more support?