AppSearchSession

public interface AppSearchSession
implements Closeable

androidx.appsearch.app.AppSearchSession


Provides a connection to a single AppSearch database.

An AppSearchSession instance provides access to database operations such as setting a schema, adding documents, and searching.

Instances of this interface are usually obtained from a storage implementation, e.g. LocalStorage.createSearchSession() or PlatformStorage.createSearchSession().

All implementations of this interface must be thread safe.

Summary

Public methods

abstract void close()

Closes the AppSearchSession to persist all schema and document updates, additions, and deletes to disk.

abstract ListenableFuture<AppSearchBatchResult<String, GenericDocument>> getByDocumentId(GetByDocumentIdRequest request)

Gets GenericDocument objects by document IDs in a namespace from the AppSearchSession database.

abstract Capabilities getCapabilities()

Returns the Capabilities to check for the availability of certain features for this session.

abstract ListenableFuture<Set<String>> getNamespaces()

Retrieves the set of all namespaces in the current database with at least one document.

abstract ListenableFuture<GetSchemaResponse> getSchema()

Retrieves the schema most recently successfully provided to setSchema(SetSchemaRequest).

abstract ListenableFuture<StorageInfo> getStorageInfo()

Gets the storage info for this AppSearchSession database.

abstract ListenableFuture<AppSearchBatchResult<String, Void>> put(PutDocumentsRequest request)

Indexes documents into the AppSearchSession database.

abstract ListenableFuture<Void> remove(String queryExpression, SearchSpec searchSpec)

Removes GenericDocuments from the index by Query.

abstract ListenableFuture<AppSearchBatchResult<String, Void>> remove(RemoveByDocumentIdRequest request)

Removes GenericDocument objects by document IDs in a namespace from the AppSearchSession database.

abstract ListenableFuture<Void> reportUsage(ReportUsageRequest request)

Reports usage of a particular document by namespace and ID.

abstract ListenableFuture<Void> requestFlush()

Flush all schema and document updates, additions, and deletes to disk if possible.

abstract SearchResults search(String queryExpression, SearchSpec searchSpec)

Retrieves documents fro