LocalStorage.SearchContext.Builder


public final class LocalStorage.SearchContext.Builder


Builder for SearchContext objects.

Summary

Public constructors

Builder(@NonNull Context context, @NonNull String databaseName)

Creates a SearchContext.Builder instance.

Public methods

@NonNull LocalStorage.SearchContext

Builds a SearchContext instance.

@NonNull LocalStorage.SearchContext.Builder

Sets the worker executor associated with AppSearchSession.

Public constructors

Builder

Added in 1.1.0-alpha06
public Builder(@NonNull Context context, @NonNull String databaseName)

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
@NonNull String databaseName

The name of the database.

Throws
java.lang.IllegalArgumentException

if the databaseName contains '/'.

Public methods

build

Added in 1.1.0-alpha06
public @NonNull LocalStorage.SearchContext build()

Builds a SearchContext instance.

setWorkerExecutor

Added in 1.1.0-alpha06
public @NonNull LocalStorage.SearchContext.Builder setWorkerExecutor(@NonNull Executor executor)

Sets the worker executor associated with AppSearchSession.

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

Parameters
@NonNull Executor executor

the worker executor used to run heavy background tasks.