I have a folder named SMITH_JOHN TAYLER_DAVID, I can only search SMITH or TAYLER but not any other ways, i.e.:
files().list(q="name contains 'SMITH'") => OK
files().list(q="name contains 'TAYLER'") => OK
files().list(q="name contains 'JOHN'") => No match!
files().list(q="name contains 'DAVID'") => No match!
files().list(q="name contains 'MITH'") => No match!
So looks like that I can only search word from the beginning of the folder name or after a space. This happens to you as well? What does "contains" mean in the REST API and how does the Python implemented this (perhaps using "match" instead of "search")?
In my environment, I confirmed the same situation with you. In your situation, the folder name is
SMITH_JOHN TAYLER_DAVID. I thought that in this case,_might be the reason for this issue. For example, when the folder name isSMITH JOHN TAYLER DAVID, your all search queries can retrieve the folder. It seems that the top letter and the letter after a space can be searched. I thought that this might be the current specification.This is used as the search query. Ref This search query is used for the method of "Files: list".
For example, if you want to retrieve the folder of the folder name of
SMITH_JOHN TAYLER_DAVIDby searching the values of'SMITH','TAYLER','JOHN','DAVID','MITH'instead of the search query ofname='SMITH_JOHN TAYLER_DAVID', you can use the following flow.name contains 'SMITH' and mimeType='application/vnd.google-apps.folder' and trashed=false.SMITH.'SMITH','TAYLER','JOHN','DAVID','MITH'from the retrieved folder list.By this flow, the folder of
SMITH_JOHN TAYLER_DAVIDcan be retrieved by one API call. When this flow is reflected in a sample script using googleapis for python, it becomes as follows.Sample script:
When this script is run, the folder of
SMITH_JOHN TAYLER_DAVIDcan be obtained.In this sample, it supposes that the number of folders including the value of
SMITHis less than 1000. Please be careful about this.References: