# GenericDocument

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

*** ** * ** ***

<br />

```
class GenericDocument
```

<br />

*** ** * ** ***

Represents a document unit.

Documents contain structured data conforming to their `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` type. Each document is uniquely identified by a namespace and a String ID within that namespace.

Documents are constructed either by using the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder` or providing an annotated `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document` data class.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#putAsync(androidx.appsearch.app.PutDocumentsRequest)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#getByDocumentIdAsync(androidx.appsearch.app.GetByDocumentIdRequest)` |   |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#search(java.lang.String,androidx.appsearch.app.SearchSpec)` |   |

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder<BuilderType : https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder?>` The builder class for `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |

| ### Protected constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#GenericDocument(androidx.appsearch.app.GenericDocument)(document: https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument)` Creates a new `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` from an existing instance. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#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/GenericDocument` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#fromDocumentClass(java.lang.Object)(document: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)` Converts an instance of a class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document` into an instance of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getCreationTimestampMillis()()` Returns the creation timestamp of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`, in milliseconds. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getId()()` Returns the unique identifier of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getNamespace()()` Returns the namespace of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves the property value with the given path as `https://developer.android.com/reference/java/lang/Object.html`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBlobHandle(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves an `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle!>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBlobHandleArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `AppSearchBlobHandle[]` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBoolean(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `boolean` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBooleanArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `boolean` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBytes(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `byte[]` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyBytesArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `byte[][]` property by path. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyDocument(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument!>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyDocumentArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyDouble(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `double` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyDoubleArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `double` property by path. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyEmbedding(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves an `EmbeddingVector` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector!>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyEmbeddingArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `EmbeddingVector[]` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyLong(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `long` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyLongArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `long[]` property by path. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-set/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyNames()()` Returns the names of all properties defined in this document. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyString(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a `https://developer.android.com/reference/java/lang/String.html` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyStringArray(java.lang.String)(path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves a repeated `String` property by path. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getSchemaType()()` Returns the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` type of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getScore()()` Returns the score of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getTtlMillis()()` Returns the TTL (time-to-live) of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`, in milliseconds. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#hashCode()()` |
| `T` | `<T> https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#toDocumentClass(java.lang.Class<T>)(documentClass: https://developer.android.com/reference/java/lang/Class.html<T!>)` Converts this GenericDocument into an instance of the provided document class. |
| `T` | `@https://developer.android.com/reference/kotlin/androidx/appsearch/app/ExperimentalAppSearchApi <T> https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#toDocumentClass(java.lang.Class<T>,androidx.appsearch.app.DocumentClassMappingContext)( documentClass: https://developer.android.com/reference/java/lang/Class.html<T!>, documentClassMappingContext: https://developer.android.com/reference/kotlin/androidx/appsearch/app/DocumentClassMappingContext )` Converts this GenericDocument into an instance of the provided document class. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#toString()()` |

## Protected constructors

### GenericDocument

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

```
protected GenericDocument(document: GenericDocument)
```

Creates a new `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` from an existing instance.

This method should be only used by constructor of a subclass.

## Public functions

### equals

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

### fromDocumentClass

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

```
java-static fun fromDocumentClass(document: Any): GenericDocument
```

Converts an instance of a class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document` into an instance of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

| Parameters |
|---|---|
| `document: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html` | An instance of a class annotated with \\@`https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` | an instance of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` produced by converting `document`. |

| 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 or an unexpected error occurs during conversion. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#toDocumentClass(java.lang.Class<T>)` |   |

### getCreationTimestampMillis

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

```
fun getCreationTimestampMillis(): Long
```

Returns the creation timestamp of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`, in milliseconds.

The value is in the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base.

### getId

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

```
fun getId(): String
```

Returns the unique identifier of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

### getNamespace

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

```
fun getNamespace(): String
```

Returns the namespace of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

### getProperty

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

```
fun getProperty(path: String): Any?
```

Retrieves the property value with the given path as `https://developer.android.com/reference/java/lang/Object.html`.

A path can be a simple property name, such as those returned by `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyNames()`. It may also be a dot-delimited path through the nested document hierarchy, with nested `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` properties accessed via `'.'` and repeated properties optionally indexed into via `[n]`.

For example, given the following `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`:

```kotlin
    (Message) {
        from: "sender@example.com"
        to: [{
            name: "Albert Einstein"
            email: "einstein@example.com"
          }, {
            name: "Marie Curie"
            email: "curie@example.com"
          }]
        tags: ["important", "inbox"]
        subject: "Hello"
    }
```

Here are some example paths and their results:

- `"from"` returns `"sender@example.com"` as a `https://developer.android.com/reference/java/lang/String.html` array with one element
- `"to"` returns the two nested documents containing contact information as a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` array with two elements
- `"to[1]"` returns the second nested document containing Marie Curie's contact information as a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` array with one element
- `"to[1].email"` returns `"curie@example.com"`
- `"to[100].email"` returns `null` as this particular document does not have that many elements in its `"to"` array.
- `"to.email"` aggregates emails across all nested documents that have them, returning `["einstein@example.com", "curie@example.com"]` as a `https://developer.android.com/reference/java/lang/String.html` array with two elements.

If you know the expected type of the property you are retrieving, it is recommended to use one of the typed versions of this method instead, such as `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyString(java.lang.String)` or `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getPropertyStringArray(java.lang.String)`.

If the property was assigned as an empty array using one of the `Builder#setProperty` functions, this method will return an empty array. If no such property exists at all, this method returns `null`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?` | The entry with the given path as an object or `null` if there is no such path. The returned object will be one of the following types: `String[]`, `long[]`, `double[]`, `boolean[]`, `byte[][]`, `GenericDocument[]`. |

### getPropertyBlobHandle

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

```
fun getPropertyBlobHandle(path: String): AppSearchBlobHandle?
```

Retrieves an `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#openBlobForReadAsync(java.util.Set<androidx.appsearch.app.AppSearchBlobHandle>)` for how to use `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to retrieve blob data.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle?` | The first `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` associated with the given path or `null` if there is no such value or the value is of a different type. |

### getPropertyBlobHandleArray

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

```
fun getPropertyBlobHandleArray(path: String): Array<AppSearchBlobHandle!>?
```

Retrieves a repeated `AppSearchBlobHandle[]` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBlobHandle(java.lang.String,androidx.appsearch.app.AppSearchBlobHandle...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBlobHandle(java.lang.String,androidx.appsearch.app.AppSearchBlobHandle...)` to an empty `AppSearchBlobHandle[]`, this method returns an empty `AppSearchBlobHandle[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle!>?` | The `AppSearchBlobHandle[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyBoolean

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

```
fun getPropertyBoolean(path: String): Boolean
```

Retrieves a `boolean` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | The first `boolean` associated with the given path or default value `false` if there is no such value or the value is of a different type. |

### getPropertyBooleanArray

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

```
fun getPropertyBooleanArray(path: String): Array<Boolean>?
```

Retrieves a repeated `boolean` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBoolean(java.lang.String,boolean...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBoolean(java.lang.String,boolean...)` to an empty `boolean[]`, this method returns an empty `boolean[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html>?` | The `boolean[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyBytes

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

```
fun getPropertyBytes(path: String): Array<Byte>?
```

Retrieves a `byte[]` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>?` | The first `byte[]` associated with the given path or `null` if there is no such value or the value is of a different type. |

### getPropertyBytesArray

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

```
fun getPropertyBytesArray(path: String): Array<Array<Byte>!>?
```

Retrieves a `byte[][]` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBytes(java.lang.String,byte[]...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBytes(java.lang.String,byte[]...)` to an empty `byte[][]`, this method returns an empty `byte[][]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>!>?` | The `byte[][]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyDocument

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

```
fun getPropertyDocument(path: String): GenericDocument?
```

Retrieves a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument?` | The first `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` associated with the given path or `null` if there is no such value or the value is of a different type. |

### getPropertyDocumentArray

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

```
fun getPropertyDocumentArray(path: String): Array<GenericDocument!>?
```

Retrieves a repeated `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyDocument(java.lang.String,androidx.appsearch.app.GenericDocument...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyDocument(java.lang.String,androidx.appsearch.app.GenericDocument...)` to an empty `GenericDocument[]`, this method returns an empty `GenericDocument[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument!>?` | The `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`\[\] associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyDouble

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

```
fun getPropertyDouble(path: String): Double
```

Retrieves a `double` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | The first `double` associated with the given path or default value `0.0` if there is no such value or the value is of a different type. |

### getPropertyDoubleArray

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

```
fun getPropertyDoubleArray(path: String): Array<Double>?
```

Retrieves a repeated `double` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyDouble(java.lang.String,double...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyDouble(java.lang.String,double...)` to an empty `double[]`, this method returns an empty `double[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html>?` | The `double[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyEmbedding

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

```
fun getPropertyEmbedding(path: String): EmbeddingVector?
```

Retrieves an `EmbeddingVector` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector?` | The first `EmbeddingVector[]` associated with the given path or `null` if there is no such value or the value is of a different type. |

### getPropertyEmbeddingArray

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

```
fun getPropertyEmbeddingArray(path: String): Array<EmbeddingVector!>?
```

Retrieves a repeated `EmbeddingVector[]` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyEmbedding(java.lang.String,androidx.appsearch.app.EmbeddingVector...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyEmbedding(java.lang.String,androidx.appsearch.app.EmbeddingVector...)` to an empty `EmbeddingVector[]`, this method returns an empty `EmbeddingVector[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/appsearch/app/EmbeddingVector!>?` | The `EmbeddingVector[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyLong

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

```
fun getPropertyLong(path: String): Long
```

Retrieves a `long` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The first `long` associated with the given path or default value `0` if there is no such value or the value is of a different type. |

### getPropertyLongArray

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

```
fun getPropertyLongArray(path: String): Array<Long>?
```

Retrieves a repeated `long[]` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyLong(java.lang.String,long...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyLong(java.lang.String,long...)` to an empty `long[]`, this method returns an empty `long[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html>?` | The `long[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getPropertyNames

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

```
fun getPropertyNames(): (Mutable)Set<String!>
```

Returns the names of all properties defined in this document.

### getPropertyString

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

```
fun getPropertyString(path: String): String?
```

Retrieves a `https://developer.android.com/reference/java/lang/String.html` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?` | The first `https://developer.android.com/reference/java/lang/String.html` associated with the given path or `null` if there is no such value or the value is of a different type. |

### getPropertyStringArray

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

```
fun getPropertyStringArray(path: String): Array<String!>?
```

Retrieves a repeated `String` property by path.

See `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getProperty(java.lang.String)` for a detailed description of the path syntax.

If the property has not been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyString(java.lang.String,java.lang.String...)`, this method returns `null`.

If it has been set via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyString(java.lang.String,java.lang.String...)` to an empty `String[]`, this method returns an empty `String[]`.

| Parameters |
|---|---|
| `path: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The path to look for. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>?` | The `String[]` associated with the given path, or `null` if no value is set or the value is of a different type. |

### getSchemaType

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

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

Returns the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` type of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

### getScore

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

```
fun getScore(): Int
```

Returns the score of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`.

The score is a query-independent measure of the document's quality, relative to other `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` objects of the same `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema` type.

Results may be sorted by score using `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchSpec.Builder#setRankingStrategy(int)`. Documents with higher scores are considered better than documents with lower scores.

Any non-negative integer can be used a score.

### getTtlMillis

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

```
fun getTtlMillis(): Long
```

Returns the TTL (time-to-live) of the `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`, in milliseconds.

The TTL is measured against `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getCreationTimestampMillis()`. At the timestamp of `creationTimestampMillis + ttlMillis`, measured in the `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()` time base, the document will be auto-deleted.

The default value is 0, which means the document is permanent and won't be auto-deleted until the app is uninstalled or `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#removeAsync(androidx.appsearch.app.RemoveByDocumentIdRequest)` is called.

### hashCode

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

### toDocumentClass

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

```
fun <T> toDocumentClass(documentClass: Class<T!>): T
```

Converts this GenericDocument into an instance of the provided document class.

It is the developer's responsibility to ensure the right kind of document class is being supplied here, either by structuring the application code to ensure the document type is known, or by checking the return value of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getSchemaType()`.

Document properties are identified by `String` names. Any that are found are assigned into fields of the given document class. As such, the most likely outcome of supplying the wrong document class would be an empty or partially populated result.

| Parameters |
|---|---|
| `documentClass: https://developer.android.com/reference/java/lang/Class.html<T!>` | a class annotated with `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document` |

| Returns |
|---|---|
| `T` | an instance of the document class after being converted from a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/exceptions/AppSearchException` | if no factory for this document class could be found on the classpath. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#fromDocumentClass(java.lang.Object)` |   |

### toDocumentClass

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

```
@ExperimentalAppSearchApi
fun <T> toDocumentClass(
    documentClass: Class<T!>,
    documentClassMappingContext: DocumentClassMappingContext
): T
```

Converts this GenericDocument into an instance of the provided document class.

It is the developer's responsibility to ensure the right kind of document class is being supplied here, either by structuring the application code to ensure the document type is known, or by checking the return value of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#getSchemaType()`.

Document properties are identified by `String` names. Any that are found are assigned into fields of the given document class. As such, the most likely outcome of supplying the wrong document class would be an empty or partially populated result.

If this GenericDocument's type is recorded as a subtype of the provided `documentClass`, the method will find an AppSearch document class, using the provided `documentClassMappingContext`, that is the most concrete and assignable to `documentClass`, and then deserialize to that class instead. This allows for more specific and accurate deserialization of GenericDocuments. If `documentClassMappingContext` has information missing or we are not able to find a candidate assignable to `documentClass`, the method will deserialize to `documentClass` directly.

Assignability is determined by the programing language's type system, and which type is more concrete is determined by AppSearch's type system specified via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSchema.Builder#addParentType(java.lang.String)` or the annotation parameter `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document#parent()`.

For nested document properties, this method will be called recursively, and `documentClassMappingContext` will be passed down to the recursive calls of this method.

For most use cases, it is recommended to utilize `https://developer.android.com/reference/kotlin/androidx/appsearch/app/SearchResult#getDocument(java.lang.Class<T>,java.util.Map<java.lang.String,java.util.List<java.lang.String>>)` instead of calling this method directly. This avoids the need to manually create a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/DocumentClassMappingContext`.

| Parameters |
|---|---|
| `documentClass: https://developer.android.com/reference/java/lang/Class.html<T!>` | a class annotated with `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document` |
| `documentClassMappingContext: https://developer.android.com/reference/kotlin/androidx/appsearch/app/DocumentClassMappingContext` | a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/DocumentClassMappingContext` instance |

| Returns |
|---|---|
| `T` | an instance of the document class after being converted from a `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` |

| Throws |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/exceptions/AppSearchException` | if no factory for this document class could be found on the classpath. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument#fromDocumentClass(java.lang.Object)` |   |

### toString

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