PlatformStorage.SearchContext.Builder

public static final class PlatformStorage.SearchContext.Builder
extends Object

java.lang.Object
   ↳ androidx.appsearch.platformstorage.PlatformStorage.SearchContext.Builder


Builder for PlatformStorage.SearchContext objects.

Summary

Public constructors

Builder(Context context, String databaseName)

Creates a PlatformStorage.SearchContext.Builder instance.

Public methods

PlatformStorage.SearchContext build()

Builds a PlatformStorage.SearchContext instance.

PlatformStorage.SearchContext.Builder setWorkerExecutor(Executor executor)

Sets the worker executor associated with AppSearchSession.

Inherited methods

Public constructors

Builder

public Builder (Context context, 
                String databaseName)

Creates a PlatformStorage.SearchContext.Builder instance.

AppSearchSession will create or open a database under the given name.

Databases with different names are fully separate with distinct schema types, namespaces, and documents.

The database name cannot contain '/'.

The database name will be visible to all system UI or third-party applications that have been granted access to any of the database's documents (for example, using SetSchemaRequest.Builder.setSchemaTypeVisibilityForPackage(String, boolean, PackageIdentifier)).

Parameters
context Context

databaseName String: The name of the database.

Throws
IllegalArgumentException if the databaseName contains '/'.

Public methods

setWorkerExecutor

public PlatformStorage.SearchContext.Builder setWorkerExecutor (Executor executor)

Sets the worker executor associated with AppSearchSession.

If an executor is not provided, the AppSearch default executor will be used.

Parameters
executor Executor: the worker executor used to run heavy background tasks.

Returns
PlatformStorage.SearchContext.Builder