com.google.android.gms.drive.metadata.SearchableCollectionMetadataField<T> |
Interface for metadata fields which hold a collection of values. Implementation of this
interface (such as the static values in
SearchableField
) can be used to create "in" filters
for file queries.
For example, the following code will find all files in the folder with ID "folder" with the MIME type "text/plain":
DriveId parent = DriveId.createFromResourceId("folder"); Filter parentFilter = Filters.in(SearchableField.PARENTS, parent); Filter mimeTypeFilter = Filters.eq(SearchableField.MIME_TYPE, "text/plain"); Query query = new Query.Builder().addFilters(parentFilter, mimeTypeFilter).build(); for (Metadata metadata : Drive.DriveApi.query(apiClient, query).await().getMetadataBuffer()) { System.out.println(metadata.getTitle()); }
Note that you must pass a SearchableCollectionMetadataField
to the Filters.in
method; a plain SearchableMetadataField
cannot be used as part of an "in" query.
However, every SearchableCollectionMetadataField
is also a
SearchableMetadataField
, so you can use a SearchableCollectionMetadataField
with
Filters.eq
(for example, if you want to find a file with an exact set of parents).