cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right 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: Does search query string match start of file extension?

Does search query string match start of file extension?

cb16
Explorer | Level 4

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?

 

3 Replies 3

Greg-DB
Dropbox 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
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
Dropbox Staff

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

Need more support?