class LocalStorage


An AppSearch storage system which stores data locally in the app's storage space using a bundled version of the search native library.

The search native library is an on-device searching library that allows apps to define androidx.appsearch.app.AppSearchSchemas, save and query a variety of Documents. The library needs to be initialized before using, which will create a folder to save data in the app's storage space.

Queries are executed multi-threaded, but a single thread is used for mutate requests (put, delete, etc..).

Summary

Nested types

Contains information relevant to creating a global search session.

Builder for GlobalSearchContext objects.

Contains information about how to create the search session.

Builder for SearchContext objects.

Public functions

java-static ListenableFuture<GlobalSearchSession!>

Opens a new GlobalSearchSession on this storage.

java-static ListenableFuture<AppSearchSession!>

Opens a new AppSearchSession on this storage with executor.

Public functions

createGlobalSearchSessionAsync

Added in 1.1.0-alpha06
java-static fun createGlobalSearchSessionAsync(
    context: LocalStorage.GlobalSearchContext
): ListenableFuture<GlobalSearchSession!>

Opens a new GlobalSearchSession on this storage.

The GlobalSearchSession opened from this LocalStorage allows the user to search across all local databases within the LocalStorage of this app, however cross-app search is not possible with LocalStorage.

This process requires a native search library. If it's not created, the initialization process will create one.

createSearchSessionAsync

Added in 1.1.0-alpha06
java-static fun createSearchSessionAsync(context: LocalStorage.SearchContext): ListenableFuture<AppSearchSession!>

Opens a new AppSearchSession on this storage with executor.

This process requires a native search library. If it's not created, the initialization process will create one.

Parameters
context: LocalStorage.SearchContext

The SearchContext contains all information to create a new AppSearchSession