SearchResults

  • SearchResults encapsulates the results of a search operation, returning a list of SearchResult objects per page.

  • To retrieve the next page of search results, you call the getNextPage() method.

  • It is mandatory to call the close() method on all SearchResults instances after fetching results.

  • This class is not thread safe.

  • This class is specific to GMSCore AppSearch and will not be synced to the Framework.

public class SearchResults extends Object
implements Closeable

Encapsulates results of a search operation.

Each AppSearchClient.search(String, SearchSpec, String) 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.

This class is specific to GMSCore AppSearch module and will not be synced to Framework.

Public Method Summary

void
close()
Task<List<SearchResult>>
getNextPage()
Retrieves the next page of SearchResult objects.

Inherited Method Summary

Public Methods

public void close ()

public Task<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.