# PlatformStorage.SearchContext

Artifact: [androidx.appsearch:appsearch-platform-storage](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/platformstorage/PlatformStorage.java+class:androidx.appsearch.platformstorage.PlatformStorage.SearchContext) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
public final class PlatformStorage.SearchContext
```

<br />

*** ** * ** ***

Contains information about how to create the search session.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext.Builder` Builder for `https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext` objects. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext#getContext()()` Returns the `https://developer.android.com/reference/android/content/Context.html` associated with the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext#getDatabaseName()()` Returns the name of the database to create or open. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html` | `https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext#getWorkerExecutor()()` Returns the worker executor associated with `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession`. |

## Public methods

### getContext

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

```
public @NonNull Context getContext()
```

Returns the `https://developer.android.com/reference/android/content/Context.html` associated with the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession`

### getDatabaseName

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

```
public @NonNull String getDatabaseName()
```

Returns the name of the database to create or open.

### getWorkerExecutor

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

```
public @NonNull Executor getWorkerExecutor()
```

Returns the worker executor associated with `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession`.

If an executor is not provided to `https://developer.android.com/reference/androidx/appsearch/platformstorage/PlatformStorage.SearchContext.Builder`, the AppSearch default executor will be returned. You should never cast the executor to `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html` and call `https://developer.android.com/reference/java/util/concurrent/ExecutorService.html#shutdownNow()`. It will cancel the futures it's returned. And since `https://developer.android.com/reference/java/util/concurrent/Executor.html#execute(java.lang.Runnable)` won't return anything, we will hang forever waiting for the execution.