# AppSearchBatchResult

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#nestedclasses)\|[Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#inhmethods)  

# AppSearchBatchResult

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchBatchResult "View this page in Kotlin")\|Java

`
public

final

class
AppSearchBatchResult
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.AppSearchBatchResult\<KeyType, ValueType\> |

<br />

*** ** * ** ***

Provides results for AppSearch batch operations which encompass multiple documents.

Individual results of a batch operation are separated into two maps: one for successes and one for failures. For successes,[getSuccesses()](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getSuccesses())will return a map of keys to instances of the value type. For failures,[getFailures()](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getFailures())will return a map of keys to[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)objects.

Alternatively,[getAll()](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getAll())returns a map of keys to[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)objects for both successes and failures.  
**See also:**

- [AppSearchSession.put(PutDocumentsRequest, Executor, BatchResultCallback)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#put(android.app.appsearch.PutDocumentsRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,java.lang.Void>))
- [AppSearchSession.getByDocumentId(GetByDocumentIdRequest, Executor, BatchResultCallback)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#getByDocumentId(android.app.appsearch.GetByDocumentIdRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,android.app.appsearch.GenericDocument>))
- [AppSearchSession.remove(RemoveByDocumentIdRequest, Executor, BatchResultCallback)](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#remove(android.app.appsearch.RemoveByDocumentIdRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,java.lang.Void>))

## Summary

|                                                                                                                                    ### Nested classes                                                                                                                                    ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [AppSearchBatchResult.Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult.Builder)`<KeyType, ValueType>` Builder for[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)objects. |

|                                                                                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                                                                                    ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<KeyType, `[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)`<ValueType>>` | ` `[getAll](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getAll())`() ` Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)for all individual results.                  |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<KeyType, `[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)`<ValueType>>` | ` `[getFailures](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getFailures())`() ` Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)for all failed individual results. |
| ` `[Map](https://developer.android.com/reference/java/util/Map)`<KeyType, ValueType>`                                                                                                     | ` `[getSuccesses](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#getSuccesses())`() ` Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of the value type for all successful individual results.                                                                           |
| ` boolean`                                                                                                                                                                                | ` `[isSuccess](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#isSuccess())`() ` Returns`true`if this[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)has no failures.                                                                                            |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                                                                     | ` `[toString](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                              |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### getAll

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Map<KeyType, AppSearchResult<ValueType>> getAll ()
```

Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)for all individual results.

The values of the[Map](https://developer.android.com/reference/java/util/Map)will not be`null`.

<br />

|                                                                                            Returns                                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [Map](https://developer.android.com/reference/java/util/Map)`<KeyType, `[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)`<ValueType>>` | <br /> |

### getFailures

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Map<KeyType, AppSearchResult<ValueType>> getFailures ()
```

Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)for all failed individual results.

The values of the[Map](https://developer.android.com/reference/java/util/Map)will not be`null`.

<br />

|                                                                                            Returns                                                                                             ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|
| [Map](https://developer.android.com/reference/java/util/Map)`<KeyType, `[AppSearchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchResult)`<ValueType>>` | <br /> |

### getSuccesses

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public Map<KeyType, ValueType> getSuccesses ()
```

Returns a[Map](https://developer.android.com/reference/java/util/Map)of keys mapped to instances of the value type for all successful individual results.

Example:[AppSearchSession.getByDocumentId](https://developer.android.com/reference/android/app/appsearch/AppSearchSession#getByDocumentId(android.app.appsearch.GetByDocumentIdRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,android.app.appsearch.GenericDocument>))returns an[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult). Each key (the document ID, of`String`type) will map to a[GenericDocument](https://developer.android.com/reference/android/app/appsearch/GenericDocument)object.

The values of the[Map](https://developer.android.com/reference/java/util/Map)will not be`null`.

<br />

|                                          Returns                                           ||
|------------------------------------------------------------------------------------|--------|
| [Map](https://developer.android.com/reference/java/util/Map)`<KeyType, ValueType>` | <br /> |

### isSuccess

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public boolean isSuccess ()
```

Returns`true`if this[AppSearchBatchResult](https://developer.android.com/reference/android/app/appsearch/AppSearchBatchResult)has no failures.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### toString

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public String toString ()
```

Returns a string representation of the object.

<br />

|                                                Returns                                                 ||
|--------------------------------------------------------------------|------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | This value cannot be`null`. <br /> |