LocalStorage.SearchContext.Builder

class LocalStorage.SearchContext.Builder


Builder for SearchContext objects.

Summary

Public constructors

Builder(context: Context, databaseName: String)

Creates a SearchContext.Builder instance.

Public functions

LocalStorage.SearchContext

Builds a SearchContext instance.

LocalStorage.SearchContext.Builder

Sets the worker executor associated with AppSearchSession.

Public constructors

Builder

Added in 1.1.0-alpha04
Builder(context: Context, databaseName: String)

Creates a 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
databaseName: String

The name of the database.

Throws
java.lang.IllegalArgumentException

if the databaseName contains '/'.

Public functions

build

Added in 1.1.0-alpha04
fun build(): LocalStorage.SearchContext

Builds a SearchContext instance.

setWorkerExecutor

Added in 1.1.0-alpha04
fun setWorkerExecutor(executor: Executor): LocalStorage.SearchContext.Builder

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.