# SearchResults

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/SearchResults.java+class:androidx.appsearch.app.SearchResults) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***

<br />

```
public interface SearchResults extends Closeable
```

<br />

*** ** * ** ***

Encapsulates results of a search operation.

Each `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#search(java.lang.String,androidx.appsearch.app.SearchSpec)` operation returns a list of `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` objects, referred to as a "page", limited by the size configured by `https://developer.android.com/reference/androidx/appsearch/app/SearchSpec.Builder#setResultCountPerPage(int)`.

To fetch a page of results, call `https://developer.android.com/reference/androidx/appsearch/app/SearchResults#getNextPageAsync()`.

All instances of `https://developer.android.com/reference/androidx/appsearch/app/SearchResults` must call `https://developer.android.com/reference/androidx/appsearch/app/SearchResults#close()` after the results are fetched.

This class is not thread safe.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/appsearch/app/SearchResults#close()()` |
| `abstract @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/app/SearchResult>>` | `https://developer.android.com/reference/androidx/appsearch/app/SearchResults#getNextPageAsync()()` Retrieves the next page of `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` objects. |

## Public methods

### close

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
abstract void close()
```

### getNextPageAsync

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

```
abstract @NonNull ListenableFuture<List<SearchResult>> getNextPageAsync()
```

Retrieves the next page of `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` objects.

The page size is configured by `https://developer.android.com/reference/androidx/appsearch/app/SearchSpec.Builder#setResultCountPerPage(int)`.

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

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/app/SearchResult>>` | a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` which resolves to a list of `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` objects. |