LocalStorage.SearchContext.Builder

public static final class LocalStorage.SearchContext.Builder
extends Object

java.lang.Object
   ↳ androidx.appsearch.localstorage.LocalStorage.SearchContext.Builder


Builder for LocalStorage.SearchContext objects.

Summary

Public constructors

Builder(Context context, String databaseName)

Creates a LocalStorage.SearchContext.Builder instance.

Public methods

LocalStorage.SearchContext build()

Builds a LocalStorage.SearchContext instance.

LocalStorage.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 LocalStorage.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 '/'.

Parameters
context Context

databaseName String: The name of the database.

Throws
IllegalArgumentException if the databaseName contains '/'.

Public methods

build

public LocalStorage.SearchContext build ()

Builds a LocalStorage.SearchContext instance.

Returns
LocalStorage.SearchContext

setWorkerExecutor

public LocalStorage.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
LocalStorage.SearchContext.Builder