andycwk
andycwk

Reputation: 846

Is there a secret switch to force Google Drive SDK to search folder and it's child folders?

I'm building a Google Drive SDK application and will be utilising search within the solution.

My aim is to be able to perform a full text search on the displayed folder and it's child folders with a single call.

My initial (and naive) attempt at this has only returned results for the immediate parent identified in the query string (root in the example below)

"'root' in parents and fullText contains 'wire'"

I've had a deep dive into the api documentation and can't find anything that would perform this.

Do Google have a secret property I can pass that will enable this activity... I can't believe for a second that they would have missed such an obvious use case out!

If I can't find an suitable option I will be forced to obtain a list of folders that make up the drive and then perform a full text search across the entire drive (this will return many more results than I need) and then filter down locally on my application server to get the folder results I want. Thus reducing the API call count to 2 (1 if I cache the folder list for a while)

Thoughts anyone?

Upvotes: 7

Views: 217

Answers (1)

Dany Gauthier
Dany Gauthier

Reputation: 800

Instead of pulling a list of all files and filter them locally, you could pull the list of folders (and sub-folders) you want to search in (or cache them like you suggested) and build your query to have something like ([FolderID1] in parents OR [FolderID2] in parents OR ... OR [FolderIDn] in parents) and fullText contains 'wire'.

Upvotes: 0

Related Questions