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)