SearchableCollectionMetadataField | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Tools & Reference
  - Developer Stories

## Results

Loading...
public interface

# SearchableCollectionMetadataField

implements SearchableMetadataField<T>

com.google.android.gms.drive.metadata.SearchableCollectionMetadataField<T>

## Class Overview

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).