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

```
class SetSchemaResponse.MigrationFailure
```

<br />

*** ** * ** ***

The class represents a post-migrated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` that failed to be saved by `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#MigrationFailure(java.lang.String,java.lang.String,java.lang.String,androidx.appsearch.app.AppSearchResult<?>)( namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, documentId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, schemaType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, failedResult: https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchResult<*> )` Constructs a new `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure`. |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchResult<https://developer.android.com/reference/java/lang/Void.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getAppSearchResult()()` Returns the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchResult` that indicates why the post-migration `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` failed to be indexed. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getDocumentId()()` Returns the id of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getNamespace()()` Returns the namespace of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SetSchemaResponse.MigrationFailure#getSchemaType()()` Returns the schema type of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` that failed to be migrated. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/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)

```
MigrationFailure(
    namespace: String,
    documentId: String,
    schemaType: String,
    failedResult: AppSearchResult<*>
)
```

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

| Parameters |
|---|---|
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The namespace of the document which failed to be migrated. |
| `documentId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The id of the document which failed to be migrated. |
| `schemaType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The type of the document which failed to be migrated. |
| `failedResult: https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchResult<*>` | 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 functions

### getAppSearchResult

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

```
fun getAppSearchResult(): AppSearchResult<Void!>
```

Returns the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchResult` that indicates why the post-migration `https://developer.android.com/reference/kotlin/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)

```
fun getDocumentId(): String
```

Returns the id of the `https://developer.android.com/reference/kotlin/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)

```
fun getNamespace(): String
```

Returns the namespace of the `https://developer.android.com/reference/kotlin/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)

```
fun getSchemaType(): String
```

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

### toString

```
fun toString(): String
```