# SetSchemaResponse

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

*** ** * ** ***


```
public final class SetSchemaResponse
```

<br />

*** ** * ** ***

The response class of `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)`

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.Builder` Builder for `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse` objects. |
| `public class https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` The class represents a post-migrated `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be saved by `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse#getDeletedTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of deleted schema types. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse#getIncompatibleTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type whose new definitions set in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call were incompatible with the pre-existing schema. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse#getMigratedTypes()()` Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type that were migrated by the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure>` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse#getMigrationFailures()()` Returns a `https://developer.android.com/reference/java/util/List.html` of all failed `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`. |

## Public methods

### getDeletedTypes

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

```
public @NonNull Set<String> getDeletedTypes()
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of deleted schema types.

A "deleted" type is a schema type that was previously a part of the database schema but was not present in the `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` object provided in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call.

Documents for a deleted type are removed from the database.

### getIncompatibleTypes

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

```
public @NonNull Set<String> getIncompatibleTypes()
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type whose new definitions set in the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call were incompatible with the pre-existing schema.

If a `https://developer.android.com/reference/androidx/appsearch/app/Migrator` is provided for this type and the migration is success triggered. The type will also appear in `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse#getMigratedTypes()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaRequest.Builder#setForceOverride(boolean)` |   |

### getMigratedTypes

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

```
public @NonNull Set<String> getMigratedTypes()
```

Returns a `https://developer.android.com/reference/java/util/Set.html` of schema type that were migrated by the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` call.

A "migrated" type is a schema type that has triggered a `https://developer.android.com/reference/androidx/appsearch/app/Migrator` instance to migrate documents of the schema type to another schema type, or to another version of the schema type.

If a document fails to be migrated, a `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` will be generated for that document.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/app/Migrator` |   |

### getMigrationFailures

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

```
public @NonNull List<SetSchemaResponse.MigrationFailure> getMigrationFailures()
```

Returns a `https://developer.android.com/reference/java/util/List.html` of all failed `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`.

A `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` will be generated if the system trying to save a post-migrated `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` but fail.

`https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure` contains the namespace, id and schemaType of the post-migrated `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` and the error reason. Mostly it will be mismatch the schema it migrated to.