SearchableOrderedMetadataField | 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

# SearchableOrderedMetadataField

implements SearchableMetadataField<T>

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

## Class Overview

Interface for metadata fields which holds an ordered value (such as a date) and which can be used for range queries. Implementations of this interface (such as the static values in `SearchableField`) can be used to create inequality filters for file queries.

For example, the following code will find all files that were modified in the last hour with the MIME type "text/plain":

     Date oneHourAgo = new Date(System.currentTimeMillis() - (60 * 60 * 1000));
     Filter dateFilter = Filters.greaterThan(SearchableField.MODIFIED_DATE, oneHourAgo);
     Filter mimeTypeFilter = Filters.eq(SearchableField.MIME_TYPE, "text/plain");
     Query query = new Query.Builder().addFilters(dateFilter, mimeTypeFilter).build();
     for (Metadata metadata : Drive.DriveApi.query(apiClient, query).await().getMetadataBuffer()) {
       System.out.println(metadata.getTitle());
     }

Note that you must pass an `SearchableOrderedMetadataField` to the `Filters.greaterThan`, `Filters.lessThan`, `Filters.lessThanEquals`, or `Filters.greaterThanEquals` methods; a plain `SearchableMetadataField` cannot be used as part of an inequality query. However, every `SearchableOrderedMetadataField` is also a `SearchableMetadataField`, so you can use a `SearchableOrderedMetadataField` with `Filters.eq` (for example, if you want to find a file that was modified at an exact time).