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.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 |
|---|
public final class LocalStorage.GlobalSearchContextContains information relevant to creating a global search session. |
public final class LocalStorage.GlobalSearchContext.BuilderBuilder for |
public final class LocalStorage.SearchContextContains information about how to create the search session. |
public final class LocalStorage.SearchContext.BuilderBuilder for |
Public methods |
|
|---|---|
static @NonNull ListenableFuture<GlobalSearchSession> |
Opens a new |
static @NonNull ListenableFuture<AppSearchSession> |
Opens a new |
static @NonNull Features |
Returns the |
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 |
getFeatures
@ExperimentalAppSearchApi
public static @NonNull Features getFeatures()
Returns the Features to check for the availability of certain features for this AppSearch storage.