Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

gavinho's avatar
gavinho
Explorer | Level 3
2 years ago
Solved

[Python SDK | API] Inconsistent results with files_search_v2

We are experiencing inconsistent results with the files_search_v2 function with both the Python SDK and API. An example is if we are searching for a particular file: '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_FRA.srt'

If we search for a particular string eg. 'TE00000114_06_0011_A2' we are returned a list of results which does not include the file in question:

 

['/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_NLD.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_CC_ENG.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_TUR.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_CMN.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_CMN_FMT.srt']

 

 

If we 'widen' the search to now search for the following string 'TE00000114_06_0011_A', the following and expected results are returned:

 

['/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_FRA.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_NLD.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_CC_ENG.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_TUR.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_CMN.srt', '/Media Coordination/VERSIONING/Graveyard_Carz_TE00000114/S06/Subs/TE00000114_06_0011_A2_S_CMN_FMT.srt']

 

 

A simplified version of the function here: 

 

def dropbox_find_local():
    dropbox_vers_path = '/Media Coordination/VERSIONING'
    search_string = 'TE00000114_06_0011_A'
    sub_ext = '.srt'
    def process_entries(entries):
        for entry in entries:
            metadata = entry.metadata.get_metadata()
            local_file = metadata.path_display
            local_list.append(local_file)
    local_list = []
    search_opt = SearchOptions(path=dropbox_vers_path, file_extensions=[sub_ext.lstrip('.')], filename_only=True)
    result = dbx.files_search_v2(search_string, options=search_opt)
    process_entries(result.matches)
    while result.has_more:
        result = dbx.files_search_continue_v2(result.cursor)
        process_entries(result.matches)
    print(local_list)

 

 

This same behaviour can be reproduced if we use the web API which uses the same files_search_v2 endpoint:
https://www.dropbox.com/search/work?path=%2FMedia+Coordination%2FVERSIONING&query=TE00000114_06_0011_A2 (Missing results)
https://www.dropbox.com/search/work?path=%2FMedia+Coordination%2FVERSIONING&query=TE00000114_06_0011_A (Expected behaviour)

 

  • Hi gavinho,

     

    The engineering team has located and fixed the issue with searching files and folders. Please let us know if you need further assistance with this case.

4 Replies

Replies have been turned off for this discussion
  • iNeil's avatar
    iNeil
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Hi gavinho,

    Thanks for the report! This case has been escalated to the engineering team. I'll follow up here once I have any updates on this.

  • iNeil's avatar
    iNeil
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Hi gavinho,

     

    The engineering team has located and fixed the issue with searching files and folders. Please let us know if you need further assistance with this case.

  • gavinho's avatar
    gavinho
    Explorer | Level 3
    2 years ago

    Hi iNeil 

     

    Thanks for the response. Confirming that the issue has been resolved. Are you able to share the details around the root cause?

     

  • iNeil's avatar
    iNeil
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    2 years ago

    Hi gavinho,

    Thank you for confirming that the issue is resolved! Unfortunately I’m unable to provide the root cause for this case. However there was an issue with our search functionality that caused inconsistent results.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

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, Facebook or Instagram.

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!