ivanvermeyen/laravel-google-drive-demo

Use custom query to find files in Google Drive

shoaibbrosol opened this issue · 4 comments

search files on base of content????

Hello,

Can you be a bit more specific? ;)

i have some files like xyz.docx which has some text (A legal drama, or a courtroom drama).
i want search file as q="fullText contains='legal'",

That seems to be possible using the API directly:
https://developers.google.com/drive/api/v3/reference/query-ref

Maybe it's also possible using the nao-pon/flysystem-google-drive package directly, but I'm not very familiar with the underlying API methods.

Hey @shoaibbrosol

You may want to follow the issue I just mentioned above.

Something you could also try is this (based on this example):

$service = Storage::cloud()->getAdapter()->getService();

$response = $service->files->listFiles([
    'q' => "'$this->folder_id' in parents and trashed=false and fullText contains 'legal'",
]);

$files = $response->files;

Here's a list of example queries:
https://developers.google.com/drive/api/v3/search-files

File list docs:
https://developers.google.com/drive/api/v3/reference/files/list