# AppSearchSchema

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) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***


```
class AppSearchSchema
```

<br />

*** ** * ** ***

The AppSearch Schema for a particular type of document.

For example, an e-mail message or a music recording could be a schema type.

The schema consists of type information, properties, and config (like tokenization type).

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#setSchemaAsync(androidx.appsearch.app.SetSchemaRequest)` |   |

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.SCHEMA_BLOB_HANDLE) class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BlobHandlePropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property of type `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` in a Document. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BlobHandlePropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BlobHandlePropertyConfig`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BooleanPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property containing a boolean. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BooleanPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BooleanPropertyConfig`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BytesPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property containing a byte array. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BytesPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.BytesPropertyConfig`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DocumentPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property containing another Document. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DocumentPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DocumentPropertyConfig`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DoublePropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property containing a double-precision decimal number. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DoublePropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.DoublePropertyConfig`. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresFeature(enforcement = "androidx.appsearch.app.Features#isFeatureSupported", name = https://developer.android.com/reference/kotlin/androidx/appsearch/app/Features.SCHEMA_EMBEDDING_PROPERTY_CONFIG) class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.EmbeddingPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property of type `https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector` in a Document. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.EmbeddingPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.EmbeddingPropertyConfig`. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.LongPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property containing a 64-bit integer. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.LongPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.LongPropertyConfig`. |
| `abstract class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Common configuration for a single property (field) in a Document. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig : https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig` Configuration for a property of type String in a Document. |
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig.Builder` Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.StringPropertyConfig`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `java-static https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#fromDocumentClass(java.lang.Class<?>)(documentClass: https://developer.android.com/reference/java/lang/Class.html<*>)` Gets the generated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` for a class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#getDescription()()` Returns a natural language description of this schema type. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#getParentTypes()()` Returns the list of parent types of this schema for polymorphism. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#getProperties()()` Returns the list of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig`s that are part of this schema. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#getSchemaType()()` Returns the name of this schema type, such as Email. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema#toString()()` |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### fromDocumentClass

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

```
@ExperimentalAppSearchApi
java-static fun fromDocumentClass(documentClass: Class<*>): AppSearchSchema
```

Gets the generated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` for a class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document`.

| Parameters |
|---|---|
| `documentClass: https://developer.android.com/reference/java/lang/Class.html<*>` | A class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` | the generated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` for the given document class. |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/exceptions/AppSearchException` | if no generated conversion class exists on the classpath for the given document class. |

### getDescription

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

```
@ExperimentalAppSearchApi
fun getDescription(): String
```

Returns a natural language description of this schema type.

Ex. The description for an Email type could be "A type of electronic message".

This information is purely to help apps consuming this type to understand its semantic meaning. This field has no effect in AppSearch - it is just stored with the AppSearchSchema. If `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.Builder#setDescription(java.lang.String)` is uncalled, then this method will return an empty string.

### getParentTypes

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

```
fun getParentTypes(): (Mutable)List<String!>
```

Returns the list of parent types of this schema for polymorphism.

### getProperties

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

```
fun getProperties(): (Mutable)List<AppSearchSchema.PropertyConfig!>
```

Returns the list of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.PropertyConfig`s that are part of this schema.

This method creates a new list when called.

### getSchemaType

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

```
fun getSchemaType(): String
```

Returns the name of this schema type, such as Email.

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String
```