# Document.StringProperty

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

*** ** * ** ***


```
@Documented
@Retention(value = RetentionPolicy.CLASS)
@Target(value = [ElementType.FIELD, ElementType.METHOD])
public annotation Document.StringProperty
```

<br />

*** ** * ** ***

Configures a string member field of a class as a property known to AppSearch.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty.DefaultSerializer implements https://developer.android.com/reference/androidx/appsearch/app/StringSerializer<https://developer.android.com/reference/java/lang/String.html>` |

| ### Public methods |
|---|---|
| `abstract int` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#indexingType()()` Configures how a property should be indexed so that it can be retrieved by queries. |
| `abstract int` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#joinableValueType()()` Configures how a property should be processed so that the document can be joined. |
| `abstract https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#name()()` The name of this property. |
| `abstract boolean` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#required()()` Configures whether this property must be specified for the document to be valid. |
| `abstract https://developer.android.com/reference/java/lang/Class.html<https://developer.android.com/reference/androidx/appsearch/app/StringSerializer<@https://developer.android.com/reference/androidx/annotation/NonNull ?>>` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#serializer()()` Configures how a property should be converted to and from a `https://developer.android.com/reference/java/lang/String.html`. |
| `abstract int` | `https://developer.android.com/reference/androidx/appsearch/annotation/Document.StringProperty#tokenizerType()()` Configures how tokens should be extracted from this property. |

## Public methods

### indexingType

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

```
public abstract int indexingType()
```

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

If not specified, defaults to `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#INDEXING_TYPE_NONE()` (the field will not be indexed and cannot be queried).

### joinableValueType

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

```
public abstract int joinableValueType()
```

Configures how a property should be processed so that the document can be joined.

Properties configured with `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_QUALIFIED_ID()` enable the documents to be joined with other documents that have the same qualified ID as the value of this field. (A qualified ID is a compact representation of the tuple that uniquely identifies a document indexed in the AppSearch storage backend.) This property name can be specified as the child property expression in for join operations.

This attribute doesn't apply to properties of a repeated type (e.g., a list).

If not specified, defaults to `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#JOINABLE_VALUE_TYPE_NONE()`, which means the property can not be used in a child property expression to configure a `https://developer.android.com/reference/androidx/appsearch/app/JoinSpec.Builder`.

### name

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

```
public abstract String name()
```

The name of this property. This string is used to query against this property.

If not specified, the name of the field in the code will be used instead.

### required

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

```
public abstract boolean required()
```

Configures whether this property must be specified for the document to be valid.

This attribute does not apply to properties of a repeated type (e.g. a list).

Please make sure you understand the consequences of required fields on `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` before setting this attribute to `true`.

### serializer

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

```
public abstract Class<StringSerializer<@NonNull ?>> serializer()
```

Configures how a property should be converted to and from a `https://developer.android.com/reference/java/lang/String.html`.

Useful for representing properties using rich types that boil down to simple string values in the database.

The referenced class must have a public zero params constructor.

For example:

```
public final class MyEntity {

    = SomeRichTypeSerializer.class)
    public SomeRichType getMyProperty();

    public final class SomeRichTypeSerializer implements StringSerializer<SomeRichType> {

      
      
      public String serialize(@NonNull SomeRichType instance) {...}

      
      
      public SomeRichType deserialize(@NonNull String string) {...}
    }
}
```

### tokenizerType

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

```
public abstract int tokenizerType()
```

Configures how tokens should be extracted from this property.

If not specified, defaults to `https://developer.android.com/reference/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig#TOKENIZER_TYPE_PLAIN()` (the field will be tokenized along word boundaries as plain text).