You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

cb16's avatar
cb16
Explorer | Level 4
5 years ago

Does search query string match start of file extension?

In https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Wildcard-search/m-p/432784 I found that we can't do a global wildcard search to find files with multiple extensions.

 

But I think there's a workaround for some cases as it seems that Dropbox matches the query string against the start of the file extension.

 

If I want to find Word documents with file extensions doc, docx, docm, dot (-> all starting with "do*") this request to https://api.dropboxapi.com/2/files/search_v2 seems to work

 

{
  "query": "do",
  "options": {
    "file_extensions": ["doc", "docx", "doxm", "dot"],
    "path": "/path_to_search",
    "filename_only": true
  }
}

Can anyone confirm that this will return the desired results reliably?

 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    While this may happen to work, I can't guarantee this will always work, since this isn't officially documented for use like this. I'll pass this along as a feature request for an official way to do this though.

    • cb16's avatar
      cb16
      Explorer | Level 4

      Thanks for the quick response.

       

      Would in fact be good to have a documentation how matching of the query string happens. This is not very clear:

       

      The string to search for. May match across multiple fields based on the request arguments. Query string may be rewritten to improve relevance of results.

       

      My tests suggest that the start of each token matches where a token means a new word, a title case word or a number. E.g. for "My WordFile123.docx" things like "my", "wo", "fil", "12", and "d" match. But like you say it's not ideal to rely on something that's not guaranteed to work in the future.

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        Thanks for the feedback! I'll pass this along to the team.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,910 PostsLatest Activity: 3 days ago
333 Following

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!