# AppSearchSchema.StringPropertyConfig.Builder

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/AppSearchSchema.java+class:androidx.appsearch.app.AppSearchSchema.StringPropertyConfig.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
public final class AppSearchSchema.StringPropertyConfig.Builder
```

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#Builder(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html propertyName)` Creates a new `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder`. |

| ### Public methods |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig` | `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#build()()` Constructs a new `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig` from the contents of this builder. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setCardinality(int)(int cardinality)` Sets the cardinality of the property (whether it is optional, required or repeated). |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `@https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setDeletePropagationType(int)(int deletePropagationType)` Configures how the deletion will be propagated between this document and the referenced document whose qualified id is held by this property. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `@https://developer.android.com/reference/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/androidx/appsearch/app/Features.SCHEMA_SET_DESCRIPTION) @https://developer.android.com/reference/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setDescription(java.lang.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html description)` Sets a natural language description of this property. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setIndexingType(int)(int indexingType)` Configures how a property should be indexed so that it can be retrieved by queries. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setJoinableValueType(int)(int joinableValueType)` Configures how this property should be used as a joining matcher. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` | `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setTokenizerType(int)(int tokenizerType)` Configures how this property should be tokenized (split into words). |

## Public constructors

### Builder

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

```
public Builder(@NonNull String propertyName)
```

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

## Public methods

### build

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

```
public @NonNull AppSearchSchema.StringPropertyConfig build()
```

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

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if any following condition: - Tokenizer type is not `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#TOKENIZER_TYPE_NONE()` with indexing type `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#INDEXING_TYPE_NONE()`. - Indexing type is not `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#INDEXING_TYPE_NONE()` with tokenizer type `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#TOKENIZER_TYPE_NONE()`. - Deletion type other than `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#DELETE_PROPAGATION_TYPE_NONE()` is used without setting `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_QUALIFIED_ID()`. |

### setCardinality

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

```
public @NonNull AppSearchSchema.StringPropertyConfig.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/androidx/appsearch/app/AppSearchSchema.PropertyConfig#CARDINALITY_OPTIONAL()`.

### setDeletePropagationType

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

```
@ExperimentalAppSearchApi
public @NonNull AppSearchSchema.StringPropertyConfig.Builder setDeletePropagationType(int deletePropagationType)
```

Configures how the deletion will be propagated between this document and the referenced document whose qualified id is held by this property.

If this method is not called, the default delete propagation type is `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#DELETE_PROPAGATION_TYPE_NONE()`, indicating that deletion will not propagate between this document and the referenced document.

If the delete propagation type is not `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#DELETE_PROPAGATION_TYPE_NONE()`, then `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_QUALIFIED_ID()` must also be set since the delete propagation has to use the qualified id. Otherwise, throw `https://developer.android.com/reference/java/lang/IllegalStateException.html` when building.

### setDescription

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

```
@RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = Features.SCHEMA_SET_DESCRIPTION)
@ExperimentalAppSearchApi
public @NonNull AppSearchSchema.StringPropertyConfig.Builder setDescription(@NonNull String description)
```

Sets a natural language description of this property.

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

### setIndexingType

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

```
public @NonNull AppSearchSchema.StringPropertyConfig.Builder setIndexingType(int indexingType)
```

Configures how a property should be indexed so that it can be retrieved by queries.

If this method is not called, the default indexing type is `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#INDEXING_TYPE_NONE()`, so that it cannot be matched by queries.

### setJoinableValueType

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

```
public @NonNull AppSearchSchema.StringPropertyConfig.Builder setJoinableValueType(int joinableValueType)
```

Configures how this property should be used as a joining matcher.

If this method is not called, the default joinable value type is `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_NONE()`, so that it is not joinable.

At most, 64 properties can be set as joinable per schema.

Callers setting `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_QUALIFIED_ID()` with `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.PropertyConfig#CARDINALITY_REPEATED()` must retrieve `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#getFeatures()` and call `https://developer.android.com/reference/androidx/appsearch/app/Features#isFeatureSupported(java.lang.String)` for `https://developer.android.com/reference/androidx/appsearch/app/Features#SCHEMA_JOINABLE_REPEATED_PROPERTIES()`.

### setTokenizerType

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

```
public @NonNull AppSearchSchema.StringPropertyConfig.Builder setTokenizerType(int tokenizerType)
```

Configures how this property should be tokenized (split into words).

If this method is not called, the default indexing type is `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#TOKENIZER_TYPE_NONE()`, so that it is not tokenized.

This method must be called with a value other than `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#TOKENIZER_TYPE_NONE()` if the property is indexed (that is, if `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder#setIndexingType(int)` has been called with a value other than `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#INDEXING_TYPE_NONE()`).