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

# Builder

*** ** * ** ***

```
class Builder
```

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

Builder for `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig`.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#Builder(kotlin.String,%20kotlin.String)(propertyName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, schemaType: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Creates a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#`. |

| Public methods ||
|---|---|
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.String)(vararg indexableNestedProperties: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Adds one or more properties for indexing from the nested document property. |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)(indexableNestedProperties: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Adds one or more properties for indexing from the nested document. |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedPropertyPaths(android.app.appsearch.PropertyPath)(vararg indexableNestedPropertyPaths: https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath!)` Adds one or more property paths for indexing from the nested document property. |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedPropertyPaths(kotlin.collections.MutableCollection)(indexableNestedPropertyPaths: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html<https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath!>)` Adds one or more property paths for indexing from the nested document property. |
| [AppSearchSchema.DocumentPropertyConfig](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#build()()` Constructs a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig` from the contents of this builder. |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setCardinality(kotlin.Int)(cardinality: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Sets the cardinality of the property (whether it is optional, required or repeated). |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setDescription(kotlin.String)(description: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sets a natural language description of this property. |
| [AppSearchSchema.DocumentPropertyConfig.Builder](https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#) | `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setShouldIndexNestedProperties(kotlin.Boolean)(indexNestedProperties: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Configures whether properties in the nested document should be indexed according to that document's schema. |

## Public constructors

### Builder

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

```
Builder(
    propertyName: String, 
    schemaType: String)
```

Creates a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#`.

| Parameters ||
|---|---|
| `propertyName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The logical name of the property in the schema, which will be used as the key for this property in `https://developer.android.com/reference/kotlin/android/app/appsearch/GenericDocument.Builder#setPropertyDocument(kotlin.String,%20android.app.appsearch.GenericDocument)`. This value cannot be `null`. |
| `schemaType` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The type of documents which will be stored in this property. Documents of different types cannot be mixed into a single property. This value cannot be `null`. |

## Public methods

### addIndexableNestedProperties

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

```
fun addIndexableNestedProperties(vararg indexableNestedProperties: String!): AppSearchSchema.DocumentPropertyConfig.Builder
```

Adds one or more properties for indexing from the nested document property.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)`

### addIndexableNestedProperties

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

```
fun addIndexableNestedProperties(indexableNestedProperties: MutableCollection<String!>): AppSearchSchema.DocumentPropertyConfig.Builder
```

Adds one or more properties for indexing from the nested document. The added property will be indexed according to that property's indexing configurations in the document's schema definition. All properties in this list will consume a sectionId regardless of its actual indexing config -- this includes properties added that do not actually exist, as well as properties that are not set as indexable in the nested schema type.

Input strings should follow the format of the property path for the nested property, with '.' as the path separator. This nested document's property name should not be included in the property path.

Ex. Consider an 'Organization' schema type which defines a nested document property 'address' (Address schema type), where Address has a nested document property 'country' (Country schema type with string 'name' property), and a string 'street' property. The 'street' and 'country's name' properties from the 'address' document property can be indexed for the 'Organization' schema type by calling:

```kotlin
<code>OrganizationSchema.addProperty(
                  new DocumentPropertyConfig.Builder("address", "Address")
                          .addIndexableNestedProperties("street", "country.name")
                          .build()).
  </code>
```

`https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setShouldIndexNestedProperties(kotlin.Boolean)` is required to be false if any indexable nested property is added this way for the document property. Attempting to build a DocumentPropertyConfig when this is not true throws `https://developer.android.com/reference/kotlin/java/lang/IllegalArgumentException.html#`.

| Parameters ||
|---|---|
| `indexableNestedProperties` | [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 ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

### addIndexableNestedPropertyPaths

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

```
fun addIndexableNestedPropertyPaths(vararg indexableNestedPropertyPaths: PropertyPath!): AppSearchSchema.DocumentPropertyConfig.Builder
```

Adds one or more property paths for indexing from the nested document property.

| Parameters ||
|---|---|
| `indexableNestedPropertyPaths` | [PropertyPath](https://developer.android.com/reference/kotlin/android/app/appsearch/PropertyPath)!: This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)`

### addIndexableNestedPropertyPaths

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

```
fun addIndexableNestedPropertyPaths(indexableNestedPropertyPaths: MutableCollection<PropertyPath!>): AppSearchSchema.DocumentPropertyConfig.Builder
```

Adds one or more property paths for indexing from the nested document property.

| Parameters ||
|---|---|
| `indexableNestedPropertyPaths` | [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`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)`

### build

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

```
fun build(): AppSearchSchema.DocumentPropertyConfig
```

Constructs a new `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig` from the contents of this builder.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` | if the provided PropertyConfig sets `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig#shouldIndexNestedProperties()` to true and has one or more properties defined using `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)`. |

### setCardinality

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

```
fun setCardinality(cardinality: Int): AppSearchSchema.DocumentPropertyConfig.Builder
```

Sets the cardinality of the property (whether it is optional, required or repeated).

If this method is not called, the default cardinality is `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_OPTIONAL:kotlin.Int`.

| Parameters ||
|---|---|
| `cardinality` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Value is one of the following: - `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_REPEATED:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_OPTIONAL:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_REQUIRED:kotlin.Int` |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

### setDescription

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

```
fun setDescription(description: String): AppSearchSchema.DocumentPropertyConfig.Builder
```

Sets a natural language description of this property.

For more details about the description field, see `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.PropertyConfig#getDescription()`.

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

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |

### setShouldIndexNestedProperties

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

```
fun setShouldIndexNestedProperties(indexNestedProperties: Boolean): AppSearchSchema.DocumentPropertyConfig.Builder
```

Configures whether properties in the nested document should be indexed according to that document's schema.

If false, the nested document's properties are not indexed regardless of its own schema.

To index a subset of properties from the nested document, set this to false and use `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(kotlin.collections.MutableCollection)`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#` | This value cannot be `null`. |