-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search does not use limit #437
Comments
I see. How I search exact name within hierarchy? Like "All
Files/folder1/folder2"?
|
@masics Unfortunately, there is not an exact way to perform that sort of search. It looks like you're already trying to use quotes to get an exact search for the name of the item you're looking for, but I think you'll need to use double quotes instead of single quotes for that. You should be able to get the most precise search results and then iterate through the results to find the exact folder you're looking for like this: search_results = client.search().query(
'"' + name + '"',
ancestor_folders=[client.folder(folder_id='XXXXXXXXX')],
result_type='folder',
content_types='name',
fields=['name', 'path_collection']
)
for item in search_results:
path = '/'.join([folder.name for folder in item.path_collection])
if path == 'All Files/folder1/folder2':
# `item` is the one you're looking for! |
I tried all kinds of quotes. If name is a single letter, the result will
include all files with that letter in the name. In my case it is thousands
of files and it takes minutes and sometimes 10s of minutes.
|
@masics Ah, if your folder name is a single letter then that does seem like it may be expected behavior. You should be able to speed up your code overall by using |
Description of the Issue
When I use limit=1 to the search query it still generates a lot results.
Versions Used
Box Python SDK: 2.5.0
Python: 3.7.3
Steps to Reproduce
Error Message, Including Traceback
I can get thousands of results in collection.
The text was updated successfully, but these errors were encountered: