# SetSchemaResponse.MigrationFailure

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.MigrationFailure) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***

<br />

```
public class SetSchemaResponse.MigrationFailure
```

<br />

*** ** * ** ***

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)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#MigrationFailure(java.lang.String,java.lang.String,java.lang.String,androidx.appsearch.app.AppSearchResult<?>)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html namespace, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html documentId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchResult<@https://developer.android.com/reference/androidx/annotation/NonNull ?> failedResult )` Constructs a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchResult<https://developer.android.com/reference/java/lang/Void.html>` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getAppSearchResult()()` Returns the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchResult` that indicates why the post-migration `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` failed to be indexed. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getDocumentId()()` Returns the id of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getNamespace()()` Returns the namespace of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getSchemaType()()` Returns the schema type of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#toString()()` |

## Public constructors

### MigrationFailure

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

```
public MigrationFailure(
    @NonNull String namespace,
    @NonNull String documentId,
    @NonNull String schemaType,
    @NonNull AppSearchResult<@NonNull ?> failedResult
)
```

Constructs a new `https://developer.android.com/reference/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html namespace` | The namespace of the document which failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html documentId` | The id of the document which failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html schemaType` | The type of the document which failed to be migrated. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchResult<@https://developer.android.com/reference/androidx/annotation/NonNull ?> failedResult` | The reason why the document failed to be indexed. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the provided `failedResult` was not a failure. |

## Public methods

### getAppSearchResult

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

```
public @NonNull AppSearchResult<Void> getAppSearchResult()
```

Returns the `https://developer.android.com/reference/androidx/appsearch/app/AppSearchResult` that indicates why the post-migration `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` failed to be indexed.

### getDocumentId

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

```
public @NonNull String getDocumentId()
```

Returns the id of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated.

### getNamespace

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

```
public @NonNull String getNamespace()
```

Returns the namespace of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated.

### getSchemaType

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

```
public @NonNull String getSchemaType()
```

Returns the schema type of the `https://developer.android.com/reference/androidx/appsearch/app/GenericDocument` that failed to be migrated.

### toString

```
public @NonNull String toString()
```