Partager via


DocumentsProvider.QuerySearchDocuments Method

Definition

Overloads

QuerySearchDocuments(String, String, String[])

Return documents that match the given query under the requested root.

QuerySearchDocuments(String, String[], Bundle)

Return documents that match the given query under the requested root.

QuerySearchDocuments(String, String, String[])

Return documents that match the given query under the requested root.

[Android.Runtime.Register("querySearchDocuments", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;", "GetQuerySearchDocuments_Ljava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Handler")]
public virtual Android.Database.ICursor? QuerySearchDocuments (string? rootId, string? query, string[]? projection);
[<Android.Runtime.Register("querySearchDocuments", "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;)Landroid/database/Cursor;", "GetQuerySearchDocuments_Ljava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Handler")>]
abstract member QuerySearchDocuments : string * string * string[] -> Android.Database.ICursor
override this.QuerySearchDocuments : string * string * string[] -> Android.Database.ICursor

Parameters

rootId
String

the root to search under.

query
String

string to match documents against.

projection
String[]

list of Document columns to put into the cursor. If null all supported columns should be included.

Returns

Attributes

Exceptions

Remarks

Return documents that match the given query under the requested root. The returned documents should be sorted by relevance in descending order. How documents are matched against the query string is an implementation detail left to each provider, but it's suggested that at least Document#COLUMN_DISPLAY_NAME be matched in a case-insensitive fashion.

If your provider is cloud-based, and you have some data cached or pinned locally, you may return the local data immediately, setting DocumentsContract#EXTRA_LOADING on the Cursor to indicate that you are still fetching additional data. Then, when the network data is available, you can send a change notification to trigger a requery and return the complete contents.

To support change notifications, you must Cursor#setNotificationUri(ContentResolver, Uri) with a relevant Uri, such as DocumentsContract#buildSearchDocumentsUri(String, String, String). Then you can call ContentResolver#notifyChange(Uri, android.database.ContentObserver, boolean) with that Uri to send change notifications.

Java documentation for android.provider.DocumentsProvider.querySearchDocuments(java.lang.String, java.lang.String, java.lang.String[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

Applies to

QuerySearchDocuments(String, String[], Bundle)

Return documents that match the given query under the requested root.

[Android.Runtime.Register("querySearchDocuments", "(Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;)Landroid/database/Cursor;", "GetQuerySearchDocuments_Ljava_lang_String_arrayLjava_lang_String_Landroid_os_Bundle_Handler", ApiSince=29)]
public virtual Android.Database.ICursor? QuerySearchDocuments (string rootId, string[]? projection, Android.OS.Bundle queryArgs);
[<Android.Runtime.Register("querySearchDocuments", "(Ljava/lang/String;[Ljava/lang/String;Landroid/os/Bundle;)Landroid/database/Cursor;", "GetQuerySearchDocuments_Ljava_lang_String_arrayLjava_lang_String_Landroid_os_Bundle_Handler", ApiSince=29)>]
abstract member QuerySearchDocuments : string * string[] * Android.OS.Bundle -> Android.Database.ICursor
override this.QuerySearchDocuments : string * string[] * Android.OS.Bundle -> Android.Database.ICursor

Parameters

rootId
String

the root to search under.

projection
String[]

list of Document columns to put into the cursor. If null all supported columns should be included.

queryArgs
Bundle

the query arguments. DocumentsContract#QUERY_ARG_EXCLUDE_MEDIA, DocumentsContract#QUERY_ARG_DISPLAY_NAME, DocumentsContract#QUERY_ARG_MIME_TYPES, DocumentsContract#QUERY_ARG_FILE_SIZE_OVER, DocumentsContract#QUERY_ARG_LAST_MODIFIED_AFTER.

Returns

cursor containing search result. Include ContentResolver#EXTRA_HONORED_ARGS in Cursor extras Bundle when any QUERY_ARG_* value was honored during the preparation of the results.

Attributes

Remarks

Return documents that match the given query under the requested root. The returned documents should be sorted by relevance in descending order. How documents are matched against the query string is an implementation detail left to each provider, but it's suggested that at least Document#COLUMN_DISPLAY_NAME be matched in a case-insensitive fashion.

If your provider is cloud-based, and you have some data cached or pinned locally, you may return the local data immediately, setting DocumentsContract#EXTRA_LOADING on the Cursor to indicate that you are still fetching additional data. Then, when the network data is available, you can send a change notification to trigger a requery and return the complete contents.

To support change notifications, you must Cursor#setNotificationUri(ContentResolver, Uri) with a relevant Uri, such as DocumentsContract#buildSearchDocumentsUri(String, String, String). Then you can call ContentResolver#notifyChange(Uri, android.database.ContentObserver, boolean) with that Uri to send change notifications.

Java documentation for android.provider.DocumentsProvider.querySearchDocuments(java.lang.String, java.lang.String[], android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to