Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#inhmethods)

# AppSearchSchema.DocumentPropertyConfig.Builder

*** ** * ** ***

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


`
public
static
final

class
AppSearchSchema.DocumentPropertyConfig.Builder
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.AppSearchSchema.DocumentPropertyConfig.Builder |

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#Builder(java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String propertyName, https://developer.android.com/reference/java/lang/String schemaType) ` Creates a new `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.lang.String[])(https://developer.android.com/reference/java/lang/String indexableNestedProperties) ` Adds one or more properties for indexing from the nested document property. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/java/lang/String> indexableNestedProperties) ` Adds one or more properties for indexing from the nested document. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedPropertyPaths(android.app.appsearch.PropertyPath[])(https://developer.android.com/reference/android/app/appsearch/PropertyPath indexableNestedPropertyPaths) ` Adds one or more property paths for indexing from the nested document property. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedPropertyPaths(java.util.Collection<android.app.appsearch.PropertyPath>)(https://developer.android.com/reference/java/util/Collection<https://developer.android.com/reference/android/app/appsearch/PropertyPath> indexableNestedPropertyPaths) ` Adds one or more property paths for indexing from the nested document property. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#build()() ` Constructs a new `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig` from the contents of this builder. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setCardinality(int)(int cardinality) ` Sets the cardinality of the property (whether it is optional, required or repeated). |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setDescription(java.lang.String)(https://developer.android.com/reference/java/lang/String description) ` Sets a natural language description of this property. |
| ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | ` https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setShouldIndexNestedProperties(boolean)(boolean indexNestedProperties) ` Configures whether properties in the nested document should be indexed according to that document's schema. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` 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 https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` 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` | ` 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` | ` 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 constructors

### Builder

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

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

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

<br />

| Parameters ||
|---|---|
| `propertyName` | `String`: 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/android/app/appsearch/GenericDocument.Builder#setPropertyDocument(java.lang.String,%20android.app.appsearch.GenericDocument[])`. This value cannot be `null`. <br /> |
| `schemaType` | `String`: 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`. <br /> |

## Public methods

### addIndexableNestedProperties

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties (String... indexableNestedProperties)
```

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

<br />

| Parameters ||
|---|---|
| `indexableNestedProperties` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)`

### addIndexableNestedProperties

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedProperties (Collection<String> indexableNestedProperties)
```

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:

    OrganizationSchema.addProperty(
                     new DocumentPropertyConfig.Builder("address", "Address")
                             .addIndexableNestedProperties("street", "country.name")
                             .build()).
     
`https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#setShouldIndexNestedProperties(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/java/lang/IllegalArgumentException`.

<br />

| Parameters ||
|---|---|
| `indexableNestedProperties` | `Collection`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

### addIndexableNestedPropertyPaths

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths (PropertyPath... indexableNestedPropertyPaths)
```

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

<br />

| Parameters ||
|---|---|
| `indexableNestedPropertyPaths` | `PropertyPath`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)`

### addIndexableNestedPropertyPaths

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder addIndexableNestedPropertyPaths (Collection<PropertyPath> indexableNestedPropertyPaths)
```

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

<br />

| Parameters ||
|---|---|
| `indexableNestedPropertyPaths` | `Collection`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)`

### build

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

```
public AppSearchSchema.DocumentPropertyConfig build ()
```

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the provided PropertyConfig sets `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig#shouldIndexNestedProperties()` to true and has one or more properties defined using `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)`. |

### setCardinality

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder setCardinality (int cardinality)
```

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/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_OPTIONAL`.

<br />

| Parameters ||
|---|---|
| `cardinality` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_REPEATED` - `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_OPTIONAL` - `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#CARDINALITY_REQUIRED` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

### setDescription

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)  
Also in [T Extensions 18](https://developer.android.com/sdkExtensions)

```
public AppSearchSchema.DocumentPropertyConfig.Builder setDescription (String description)
```

Sets a natural language description of this property.

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

<br />

| Parameters ||
|---|---|
| `description` | `String`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |

### setShouldIndexNestedProperties

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

```
public AppSearchSchema.DocumentPropertyConfig.Builder setShouldIndexNestedProperties (boolean indexNestedProperties)
```

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/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder#addIndexableNestedProperties(java.util.Collection<java.lang.String>)`.

<br />

| Parameters ||
|---|---|
| `indexNestedProperties` | `boolean` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.DocumentPropertyConfig.Builder` | This value cannot be `null`. <br /> |