# 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 />

```
interface SearchResults : Closeable
```

<br />

*** ** * ** ***

Encapsulates results of a search operation.

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

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

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

This class is not thread safe.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResults#close()()` |
| `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult!>!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResults#getNextPageAsync()()` Retrieves the next page of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult` objects. |

## Public functions

### close

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

```
fun close(): Unit
```

### getNextPageAsync

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

```
fun getNextPageAsync(): ListenableFuture<(Mutable)List<SearchResult!>!>
```

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

The page size is configured by `https://developer.android.com/reference/kotlin/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://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/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/kotlin/androidx/appsearch/app/SearchResult` objects. |