SearchableCollectionMetadataField
Stay organized with collections
Save and categorize content based on your preferences.
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).
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."],[[["`SearchableCollectionMetadataField` allows creating \"in\" filters for querying files with specific metadata values within a collection."],["It's used with `Filters.in()` to find files matching multiple values of a field, like finding files with a specific MIME type within a specific folder."],["While designed for \"in\" filters, it can also be used with `Filters.eq()` for precise matching of a collection of values."],["An example provided demonstrates building a query to find text files within a specified folder using this interface and related classes."]]],[]]