Make files searchable in Google Drive: Stakes around the content of less common or custom file types.
We have learned from Nicolas, also the lead engineer for the OAuth 2.0 Playground that, when a file of a common type is uploaded
to Google Drive, it is automatically indexed so users can easily search for it
in their Drive files.
In addition if a user uploaded
a list of customers as an
HTML, XML, PDF or text file he could easily find it
later by searching for one of its customer’s name that is written inside the
file.
‘’However, Google Drive does
not automatically index the content of less common or custom file types. For
example if your application uploads or creates files using the custom MIME-type
custom/mime.type, then Drive would not try to read and index the
content of these files and your users would not be able to find them by
searching for something that’s inside these files.’’
So to have Google Drive index
the content of such files, he recommends using one of the following two options
available when uploading files through the Google Drive API:
useContentAsIndexableText URL parameter
The team recently added a way
for you to indicate that the file you are uploading is using a readable text
format. In the case where your file data format is text based ,for instance if
you are using XML or JSON , you can simply set the useContentAsIndexableText URL parameter to true when uploading the file’s content to
Drive. When this flag is set Google Drive will try to read the content of the
file as text and index it.
indexableText attribute : Billed as a flexible approach which is to set the indexableText attribute on the File Metadata. Therefore you can set the
value of the indexableText attribute which is a hidden, write-only,
attribute that we will index for search. Aims to be useful if you are using a
shortcut file ,in which
case there is no content uploaded to Google Drive , or if you are using a
non-text or binary file format which Google Drive won’t be able to read.
Finally you can watch the latest
Google
Developer Live video about the topic to learn more.