SearchResults

public interface SearchResults
implements Closeable

androidx.appsearch.app.SearchResults


Encapsulates results of a search operation.

Each AppSearchSession.search(String, SearchSpec) operation returns a list of SearchResult objects, referred to as a "page", limited by the size configured by SearchSpec.Builder.setResultCountPerPage(int).

To fetch a page of results, call getNextPage().

All instances of SearchResults must call close() after the results are fetched.

This class is not thread safe.

Summary

Public methods

abstract void close()
abstract ListenableFuture<List<SearchResult>> getNextPage()

Retrieves the next page of SearchResult objects.

Inherited methods

Public methods

close

public abstract void close ()

getNextPage

public abstract ListenableFuture<List<SearchResult>> getNextPage ()

Retrieves the next page of SearchResult objects.

The page size is configured by SearchSpec.Builder.setResultCountPerPage(int).

Continue calling this method to access results until it returns an empty list, signifying there are no more results.

Returns
ListenableFuture<List<SearchResult>> a ListenableFuture which resolves to a list of SearchResult objects.