cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

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: 
Highlighted

Python files_search return empty?

New member | Level 1
New member | Level 1

Not sure what's happening but I'm working on a little python tool to look up a file by name in a given dropbox. I can do a files_list_folder fine and see the results:

dbx.files_list_folder('')
ListFolderResult(entries=[FolderMetadata(name='Team Files', id='id:mkPLvUa8vRAAAAAAAAAAAg', path_lower='/team files', path_display='/Team Files', parent_shared_folder_id=None, shared_folder_id='1287208110', sharing_info=FolderSharingInfo(read_only=False, parent_shared_folder_id=None, shared_folder_id='1287208110'), property_groups=None), FolderMetadata(name='public', id='id:mkPLvUa8vRAAAAAAAAAAIw', path_lower='/public', path_display='/public', parent_shared_folder_id=None, shared_folder_id=None, sharing_info=None, property_groups=None), FolderMetadata(name='test', id='id:mkPLvUa8vRAAAAAAAAAAJA', path_lower='/test', path_display='/test', parent_shared_folder_id=None, shared_folder_id=None, sharing_info=None, property_groups=None), FileMetadata(name='nate.png', id='id:mkPLvUa8vRAAAAAAAAAAPA', client_modified=datetime.datetime(2016, 8, 1, 18, 40, 11), server_modified=datetime.datetime(2016, 8, 16, 21, 41, 5, rev='454cb918c3', size=38806, path_lower='/nate.png', path_display='/nate.png', parent_shared_folder_id=None, media_info=None, sharing_info=None, property_groups=None, has_explicit_shared_members=None)], cursor='AAGJecrngGsg6I7pFXXhuxK2RNpTIdXSzLw-3YRrttJjeC9sFWjQ6zZ8Zqjz5bbpXe4VXAQpwbF9f8x01b5xP1c6Gj_TtaGd1yqyOodee35FlVdcTASSOXdBODxFJyV2r3EcHK4wwV6lo1vZkq7YLA68', has_more=False)

 

But doing a search returns empty. Am I messing up the query or doing something wrong?
dbx.files_search('', '.png')
SearchResult(matches=[], more=False, start=0)

4 Replies 4
Highlighted

Re: Python files_search return empty?

Dropboxer
Dropboxer

There can be some lag on search results (as opposed to the list_folder result). Are you still seeing this now that some time has gone by?

Highlighted

Re: Python files_search return empty?

New member | Level 1
New member | Level 1

I tried again this morning and I am finally seeing some results. Is there any metric on the standard lag for search results?

I had loaded files then waited about 30 minutes without any search results coming back but list files worked fine. This also kind of begs the question... why the difference in behavior between list and search? Aren't they roughly equivalent styles of operations?

files_search(", "Foo") seems like it should be the same as if I did

files_list_folder(") filtered with "Foo" in metadata.name

Although that may be dependent on your backend infrastructure but from an API standpoint they both look like hierarchy walkers but react/operate very differently.

Highlighted

Re: Python files_search return empty?

Dropboxer
Dropboxer

Thanks for following up on this Nathan. The lag is usually relatively short, but it can vary, and can be on the scale of minutes.

Anyway, the search and list_folder operations do operate using entirely different mechanisms. So, in general, if you can use list_folder in any particular scenario, that would be the better choice.

Highlighted

Re: Python files_search return empty?

New member | Level 1
New member | Level 1

Thanks Gregory; I was just a bit surprised by this delay especially comparing it to the sync operation when looking at files/folders uploaded in the Dropbox App on multiple Windows system. Both systems showed the files as synced but search was still returning empty which is what started my concern that I had hit a possible bug

My tool is trying to walk through a heirarchy to find a particular file by name (I wish I could do by MD5 or SHA1 as well but that doesn't seem to be supported) and I would hate to have to walk through the user's entire dropbox to find a particular file (or multiple instances of that file) as that seems extremely expensive. I will simply note that there may be a delay so users are aware.

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?