SearchableMetadataField
Stay organized with collections
Save and categorize content based on your preferences.
Known Indirect Subclasses
|
Interface for metadata fields that can be used to filter results as part of file queries.
Implementation of this interface (such as the static values in SearchableField
)
can be used to create filters for file or folder queries.
For example, the following code will find all files that are starred and have the MIME
type type "text/plain":
Filter starredFilter = Filters.eq(SearchableField.STARRED, true);
Filter mimeTypeFilter = Filters.eq(SearchableField.MIME_TYPE, "text/plain");
Query query = new Query.Builder().addFilters(starredFilter, mimeTypeFilter).build();
for (Metadata metadata : Drive.DriveApi.query(apiClient, query).await().getMetadataBuffer()) {
System.out.println(metadata.getTitle());
}
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["`SearchableMetadataField` enables filtering results in file queries using metadata."],["It's implemented by static values in `SearchableField` to create filters for queries."],["You can combine multiple filters (like \"starred\" and \"MIME type\") for complex searches."],["This interface is extended by `SearchableCollectionMetadataField` and `SearchableOrderedMetadataField` for handling specific data types."]]],["`SearchableMetadataField` is an interface for filtering file query results. It allows creating filters for file or folder searches. `SearchableCollectionMetadataField` and `SearchableOrderedMetadataField` are its subclasses. Implementations can be used to construct filters, such as finding files that are starred or have a specific MIME type. The example demonstrates building a query with multiple filters, including a boolean and string equality, and retrieving matching metadata.\n"]]