LocalStorage
public 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.AppSearchSchema
s, save and query a variety of Document
s. 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 |
---|
public final class LocalStorage.GlobalSearchContext Contains information relevant to creating a global search session. |
public final class LocalStorage.GlobalSearchContext.Builder Builder for |
public final class LocalStorage.SearchContext Contains information about how to create the search session. |
public final class LocalStorage.SearchContext.Builder Builder for |
Public methods |
|
---|---|
static @NonNull ListenableFuture<GlobalSearchSession> |
Opens a new |
static @NonNull ListenableFuture<AppSearchSession> |
Opens a new |
Public methods
createGlobalSearchSessionAsync
public static @NonNull ListenableFuture<GlobalSearchSession> createGlobalSearchSessionAsync(
@NonNull LocalStorage.GlobalSearchContext context
)
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
public static @NonNull ListenableFuture<AppSearchSession> createSearchSessionAsync(@NonNull LocalStorage.SearchContext context)
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 | |
---|---|
@NonNull LocalStorage.SearchContext context |
The |