#question, how can we list - recursive with name contains "searchTxt"?
ceggn opened this issue · 4 comments
Hello @nao-pon, @ivanvermeyen
Great work, Thanks for creating this amazing things, this help us more to save our time.
I create a demo and works perfectly.
But question is we have search functionality, so if user enter any characters we need to give list with files and folder that contains that search text in it's name parameter.
I have searched in https://github.com/nao-pon/flysystem-google-drive/blob/master/src/GoogleDriveAdapter.php, and found function named 'getItems' that have one parameter 'query', but i can not found what should i pass in that so i can get result as i required.
And also, how can i overwrite this file or function in my demo.
Get some success, but 2 more query.
We can pass query as: $query = 'name contains 'temp' ';
Problem 1: we can not give more parameter for "listContents" because it's not direct GoogleDriveAdapter::listContents call, so we need a proper way to pass query in arguments.
Problem 2: with query "temp", it will find file or directory with "temp" in name as word. So give you "temp Dir", "new temp" and "abc temp abc". But not "tempabc". Also tried with "%temp%".
If any one have idea please reply.
@ceggn For Problem 1, just a hint. There is a way to create a Flysystem plugin and extend flysystem-google-drive. But I don't know much about that plugin system.
Hello,
I've been getting similar questions on the demo repo (eg. #77) about using specific queries to find files in Google Drive. As stated above, the listContents()
only accepts a folder ID and a $recursive
option.
However, that method calls getItems()
which does accept a custom (optional) query.
Is there a reason why listContent()
has a more limited signature? Or can the optional parameters be added there as well?
listContents()
method:
flysystem-google-drive/src/GoogleDriveAdapter.php
Lines 565 to 568 in 37f4bde
getItems()
method:
As a reference, here is a list with example queries:
https://developers.google.com/drive/api/v3/search-files