Partager via


GlobalSearchSession.Search(String, SearchSpec) Method

Definition

Retrieves documents from all AppSearch databases that the querying application has access to.

[Android.Runtime.Register("search", "(Ljava/lang/String;Landroid/app/appsearch/SearchSpec;)Landroid/app/appsearch/SearchResults;", "GetSearch_Ljava_lang_String_Landroid_app_appsearch_SearchSpec_Handler", ApiSince=31)]
public virtual Android.App.AppSearch.SearchResults Search (string queryExpression, Android.App.AppSearch.SearchSpec searchSpec);
[<Android.Runtime.Register("search", "(Ljava/lang/String;Landroid/app/appsearch/SearchSpec;)Landroid/app/appsearch/SearchResults;", "GetSearch_Ljava_lang_String_Landroid_app_appsearch_SearchSpec_Handler", ApiSince=31)>]
abstract member Search : string * Android.App.AppSearch.SearchSpec -> Android.App.AppSearch.SearchResults
override this.Search : string * Android.App.AppSearch.SearchSpec -> Android.App.AppSearch.SearchResults

Parameters

queryExpression
String

query string to search.

searchSpec
SearchSpec

spec for setting document filters, adding projection, setting term match type, etc.

Returns

a SearchResults object for retrieved matched documents.

Attributes

Remarks

Retrieves documents from all AppSearch databases that the querying application has access to.

Applications can be granted access to documents by specifying SetSchemaRequest.Builder#setSchemaTypeVisibilityForPackage when building a schema.

Document access can also be granted to system UIs by specifying SetSchemaRequest.Builder#setSchemaTypeDisplayedBySystem when building a schema.

See AppSearchSession#search for a detailed explanation on forming a query string.

This method is lightweight. The heavy work will be done in SearchResults#getNextPage.

Java documentation for android.app.appsearch.GlobalSearchSession.search(java.lang.String, android.app.appsearch.SearchSpec).

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