ivanvermeyen / laravel-google-drive-demo

Laravel & Google Drive Storage - Demo project with Laravel 5.4
405 stars 155 forks source link

Use custom query to find files in Google Drive #77

Open shoaibbrosol opened 4 years ago

shoaibbrosol commented 4 years ago

search files on base of content????

ivanvermeyen commented 4 years ago

Hello,

Can you be a bit more specific? ;)

shoaibbrosol commented 4 years ago

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'",

ivanvermeyen commented 4 years ago

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.

ivanvermeyen commented 4 years ago

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