# GetByDocumentIdRequest.Builder

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

# Builder

*** ** * ** ***

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

```
class Builder
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                               ||
| ↳ | [android.app.appsearch.GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) |

Builder for[GetByDocumentIdRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest)objects.

## Summary

|                                                                                                                                                                                         Public constructors                                                                                                                                                                                          ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#Builder(kotlin.String))`(`namespace:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`)` Creates a[GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#)instance. |

|                                                                                                                                                                                                                                                                                                                                                                          Public methods                                                                                                                                                                                                                                                                                                                                                                           ||
|----------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | [addIds](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#addIds(kotlin.String))`(`vararg` `ids:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Adds one or more document IDs to the request.                                                                                                                                                                                                                                                                                                                                  |
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | [addIds](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#addIds(kotlin.collections.MutableCollection))`(`ids:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>`)` Adds a collection of IDs to the request.                                                                                                                                                                                                    |
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | [addProjection](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#addProjection(kotlin.String,%20kotlin.collections.MutableCollection))`(`schemaType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `propertyPaths:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>`)` Adds property paths for the specified type to be used for projection.                            |
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | [addProjectionPaths](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#addProjectionPaths(kotlin.String,%20kotlin.collections.MutableCollection))`(`schemaType:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)`, `propertyPaths:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[PropertyPath](https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath)!>`)` Adds property paths for the specified type to be used for projection. |
| [GetByDocumentIdRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest)                  | [build](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#build())`()` Builds a new[GetByDocumentIdRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest).                                                                                                                                                                                                                                                                                                                                                               |

## Public constructors

### Builder

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

```
Builder(namespace: String)
```

Creates a[GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#)instance.

|                                                        Parameters                                                         ||
|-------------|--------------------------------------------------------------------------------------------------------------|
| `namespace` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`. |

## Public methods

### addIds

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

```
fun addIds(vararg ids: String!): GetByDocumentIdRequest.Builder
```

Adds one or more document IDs to the request.

|                                                      Parameters                                                      ||
|-------|---------------------------------------------------------------------------------------------------------------|
| `ids` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:This value cannot be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | This value cannot be`null`. |

### addIds

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

```
fun addIds(ids: MutableCollection<String!>): GetByDocumentIdRequest.Builder
```

Adds a collection of IDs to the request.

|                                                                                                                 Parameters                                                                                                                  ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `ids` | [MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>:This value cannot be`null`. |

|                                                                               Return                                                                                ||
|----------------------------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetByDocumentIdRequest.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest.Builder#) | This value cannot be`null`. |

### addProjection

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

```
fun addProjection(
    schemaType: String, 
    propertyPaths: MutableCollection<String!>
): GetByDocumentIdRequest.Builder
```

Adds property paths for the specified type to be used for projection. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type. If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

If property path is added for the[android.app.appsearch.GetByDocumentIdRequest#PROJECTION_SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest#PROJECTION_SCHEMA_TYPE_WILDCARD:kotlin.String), then those property paths will apply to all results, excepting any types that have their own, specific property paths set.

|                                                                                                                      Parameters                                                                                                                       ||
|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `schemaType`    | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`.                                                                                                                         |
| `propertyPaths` | [MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>:This value cannot be`null`. |

**See Also**

- [android.app.appsearch.SearchSpec.Builder#addProjectionPaths](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec.Builder#addProjectionPaths(kotlin.String,%20kotlin.collections.MutableCollection))  

### addProjectionPaths

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in[T Extensions 7](https://developer.android.com/sdkExtensions)  

```
fun addProjectionPaths(
    schemaType: String, 
    propertyPaths: MutableCollection<PropertyPath!>
): GetByDocumentIdRequest.Builder
```

Adds property paths for the specified type to be used for projection. If property paths are added for a type, then only the properties referred to will be retrieved for results of that type. If a property path that is specified isn't present in a result, it will be ignored for that result. Property paths cannot be null.

If no property paths are added for a particular type, then all properties of results of that type will be retrieved.

If property path is added for the[android.app.appsearch.GetByDocumentIdRequest#PROJECTION_SCHEMA_TYPE_WILDCARD](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest#PROJECTION_SCHEMA_TYPE_WILDCARD:kotlin.String), then those property paths will apply to all results, excepting any types that have their own, specific property paths set.

|                                                                                                                               Parameters                                                                                                                               ||
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `schemaType`    | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html):This value cannot be`null`.                                                                                                                                          |
| `propertyPaths` | [MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)\<[PropertyPath](https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath)!\>:This value cannot be`null`. |

**See Also**

- [android.app.appsearch.SearchSpec.Builder#addProjectionPaths](https://developer.android.com/reference/kotlin/android/app/appsearch/SearchSpec.Builder#addProjectionPaths(kotlin.String,%20kotlin.collections.MutableCollection))  

### build

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

```
fun build(): GetByDocumentIdRequest
```

Builds a new[GetByDocumentIdRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest).

|                                                                       Return                                                                       ||
|-----------------------------------------------------------------------------------------------------------------------|-----------------------------|
| [GetByDocumentIdRequest](https://developer.android.com/reference/kotlin/android/app/appsearch/GetByDocumentIdRequest) | This value cannot be`null`. |