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/GenericDocument.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#inhmethods)

# GenericDocument.Builder

*** ** * ** ***


`
public
static


class
GenericDocument.Builder
`


`

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


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.GenericDocument.Builder\<BuilderType extends [android.app.appsearch.GenericDocument.Builder](https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder)\<BuilderType\>\> |

|---|
| Known direct subclasses [AppSearchAccount.Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchAccount.Builder) |---|---| | [AppSearchAccount.Builder](https://developer.android.com/reference/android/app/appsearch/AppSearchAccount.Builder) | The builder class for `https://developer.android.com/reference/android/app/appsearch/AppSearchAccount`. | |

<br />

*** ** * ** ***

The builder class for `https://developer.android.com/reference/android/app/appsearch/GenericDocument`.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#Builder(android.app.appsearch.GenericDocument)(https://developer.android.com/reference/android/app/appsearch/GenericDocument document) ` Creates a new `https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder` from the given GenericDocument. |
| ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#Builder(java.lang.String,%20java.lang.String,%20java.lang.String)(https://developer.android.com/reference/java/lang/String namespace, https://developer.android.com/reference/java/lang/String id, https://developer.android.com/reference/java/lang/String schemaType) ` Creates a new `https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder`. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/app/appsearch/GenericDocument` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#build()() ` Builds the `https://developer.android.com/reference/android/app/appsearch/GenericDocument` object. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#clearProperty(java.lang.String)(https://developer.android.com/reference/java/lang/String name) ` Clears the value for the property with the given name. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setCreationTimestampMillis(long)(long creationTimestampMillis) ` Sets the creation timestamp of the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`, in milliseconds. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setId(java.lang.String)(https://developer.android.com/reference/java/lang/String id) ` Sets the ID of this document, changing the value provided in the constructor. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setNamespace(java.lang.String)(https://developer.android.com/reference/java/lang/String namespace) ` Sets the app-defined namespace this document resides in, changing the value provided in the constructor. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyBlobHandle(java.lang.String,%20android.app.appsearch.AppSearchBlobHandle[])(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/app/appsearch/AppSearchBlobHandle values) ` Sets one or multiple `https://developer.android.com/reference/android/app/appsearch/AppSearchBlobHandle` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyBoolean(java.lang.String,%20boolean[])(https://developer.android.com/reference/java/lang/String name, boolean... values) ` Sets one or multiple `boolean` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyBytes(java.lang.String,%20byte[][])(https://developer.android.com/reference/java/lang/String name, byte... values) ` Sets one or multiple `byte[]` for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyDocument(java.lang.String,%20android.app.appsearch.GenericDocument[])(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/app/appsearch/GenericDocument values) ` Sets one or multiple `https://developer.android.com/reference/android/app/appsearch/GenericDocument` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyDouble(java.lang.String,%20double[])(https://developer.android.com/reference/java/lang/String name, double... values) ` Sets one or multiple `double` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyEmbedding(java.lang.String,%20android.app.appsearch.EmbeddingVector[])(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/android/app/appsearch/EmbeddingVector values) ` Sets one or multiple `EmbeddingVector` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyLong(java.lang.String,%20long[])(https://developer.android.com/reference/java/lang/String name, long... values) ` Sets one or multiple `long` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyString(java.lang.String,%20java.lang.String[])(https://developer.android.com/reference/java/lang/String name, https://developer.android.com/reference/java/lang/String values) ` Sets one or multiple `String` values for a property, replacing its previous values. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setSchemaType(java.lang.String)(https://developer.android.com/reference/java/lang/String schemaType) ` Sets the schema type of this document, changing the value provided in the constructor. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setScore(int)(int score) ` Sets the score of the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`. |
| ` BuilderType` | ` https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setTtlMillis(long)(long ttlMillis) ` Sets the TTL (time-to-live) of the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`, in milliseconds. |

| ### 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 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in [T Extensions 13](https://developer.android.com/sdkExtensions)

```
public Builder (GenericDocument document)
```

Creates a new `https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder` from the given GenericDocument.

The GenericDocument is deep copied, that is, it changes to a new GenericDocument
returned by this function and will NOT affect the original GenericDocument.

<br />

| Parameters ||
|---|---|
| `document` | `GenericDocument`: This value cannot be `null`. <br /> |

### Builder

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

```
public Builder (String namespace, 
                String id, 
                String schemaType)
```

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

Document IDs are unique within a namespace.

The number of namespaces per app should be kept small for efficiency reasons.

<br />

| Parameters ||
|---|---|
| `namespace` | `String`: the namespace to set for the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`. This value cannot be `null`. <br /> |
| `id` | `String`: the unique identifier for the `https://developer.android.com/reference/android/app/appsearch/GenericDocument` in its namespace. This value cannot be `null`. <br /> |
| `schemaType` | `String`: the `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema` type of the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`. The provided `schemaType` must be defined using `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#setSchema(android.app.appsearch.SetSchemaRequest,%20java.util.concurrent.Executor,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.SetSchemaResponse>>)` prior to inserting a document of this `schemaType` into the AppSearch index using `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#put(android.app.appsearch.PutDocumentsRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,java.lang.Void>)`. Otherwise, the document will be rejected by `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#put(android.app.appsearch.PutDocumentsRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,java.lang.Void>)` with result code `https://developer.android.com/reference/android/app/appsearch/AppSearchResult#RESULT_NOT_FOUND`. This value cannot be `null`. <br /> |

## Public methods

### build

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

```
public GenericDocument build ()
```

Builds the `https://developer.android.com/reference/android/app/appsearch/GenericDocument` object.

<br />

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

### clearProperty

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 BuilderType clearProperty (String name)
```

Clears the value for the property with the given name.

Note that this method does not support property paths.

You should check for the existence of the property in `https://developer.android.com/reference/android/app/appsearch/GenericDocument#getPropertyNames()` if you
need to make sure the property being cleared actually exists.

If the string passed is an invalid or nonexistent property, no error message or
behavior will be observed.

<br />

| Parameters ||
|---|---|
| `name` | `String`: The name of the property to clear. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

### setCreationTimestampMillis

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

```
public BuilderType setCreationTimestampMillis (long creationTimestampMillis)
```

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

This should be set using a value obtained from the `https://developer.android.com/reference/java/lang/System#currentTimeMillis()`
time base.

If this method is not called, this will be set to the time the object is built.

<br />

| Parameters ||
|---|---|
| `creationTimestampMillis` | `long`: a creation timestamp in milliseconds. Value is a non-negative timestamp measured as the number of milliseconds since 1970-01-01T00:00:00Z. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

### setId

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 BuilderType setId (String id)
```

Sets the ID of this document, changing the value provided in the constructor. No special
values are reserved or understood by the infrastructure.

Document IDs are unique within the combination of package, database, and namespace.

Setting a document with a duplicate id will overwrite the original document with the
new document, enforcing uniqueness within the above constraint.

<br />

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

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

### setNamespace

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 BuilderType setNamespace (String namespace)
```

Sets the app-defined namespace this document resides in, changing the value provided in
the constructor. No special values are reserved or understood by the infrastructure.

Document IDs are unique within a namespace.

The number of namespaces per app should be kept small for efficiency reasons.

<br />

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

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

### setPropertyBlobHandle

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

```
public BuilderType setPropertyBlobHandle (String name, 
                AppSearchBlobHandle... values)
```

Sets one or multiple `https://developer.android.com/reference/android/app/appsearch/AppSearchBlobHandle` values for a property, replacing its
previous values.

`https://developer.android.com/reference/android/app/appsearch/AppSearchBlobHandle` is a pointer to a blob of data.

Store large byte via the `https://developer.android.com/reference/android/os/ParcelFileDescriptor` returned from `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#openBlobForWrite(java.util.Set<android.app.appsearch.AppSearchBlobHandle>,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.OpenBlobForWriteResponse>>)`. Once the blob data is committed via `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#commitBlob(java.util.Set<android.app.appsearch.AppSearchBlobHandle>,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.CommitBlobResponse>>)`, the blob is retrievable via `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#openBlobForRead(java.util.Set<android.app.appsearch.AppSearchBlobHandle>,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.OpenBlobForReadResponse>>)`.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `AppSearchBlobHandle`: the `https://developer.android.com/reference/android/app/appsearch/AppSearchBlobHandle` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the name is empty or `null`. |

### setPropertyBoolean

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

```
public BuilderType setPropertyBoolean (String name, 
                boolean... values)
```

Sets one or multiple `boolean` values for a property, replacing its previous
values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `boolean`: the `boolean` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the name is empty or `null`. |

### setPropertyBytes

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

```
public BuilderType setPropertyBytes (String name, 
                byte... values)
```

Sets one or multiple `byte[]` for a property, replacing its previous values.

For large byte data and lazy retrieval, see `https://developer.android.com/reference/android/app/appsearch/GenericDocument.Builder#setPropertyBlobHandle(java.lang.String,%20android.app.appsearch.AppSearchBlobHandle[])`.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `byte`: the `byte[]` of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if no values are provided, or if a passed in `byte[]` is `null`, or if name is empty. |

### setPropertyDocument

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

```
public BuilderType setPropertyDocument (String name, 
                GenericDocument... values)
```

Sets one or multiple `https://developer.android.com/reference/android/app/appsearch/GenericDocument` values for a property, replacing its
previous values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `GenericDocument`: the `https://developer.android.com/reference/android/app/appsearch/GenericDocument` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if no values are provided, or if a passed in `https://developer.android.com/reference/android/app/appsearch/GenericDocument` is `null`, or if name is empty. |

### setPropertyDouble

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

```
public BuilderType setPropertyDouble (String name, 
                double... values)
```

Sets one or multiple `double` values for a property, replacing its previous values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `double`: the `double` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the name is empty or `null`. |

### setPropertyEmbedding

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

```
public BuilderType setPropertyEmbedding (String name, 
                EmbeddingVector... values)
```

Sets one or multiple `EmbeddingVector` values for a property, replacing its
previous values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `EmbeddingVector`: the `EmbeddingVector` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the name is empty or `null`. |

### setPropertyLong

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

```
public BuilderType setPropertyLong (String name, 
                long... values)
```

Sets one or multiple `long` values for a property, replacing its previous values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `long`: the `long` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the name is empty or `null`. |

### setPropertyString

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

```
public BuilderType setPropertyString (String name, 
                String... values)
```

Sets one or multiple `String` values for a property, replacing its previous values.

<br />

| Parameters ||
|---|---|
| `name` | `String`: the name associated with the `values`. Must match the name for this property as given in `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema.PropertyConfig#getName()`. This value cannot be `null`. <br /> |
| `values` | `String`: the `String` values of the property. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if no values are provided, or if a passed in `String` is `null` or "". |

### setSchemaType

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 BuilderType setSchemaType (String schemaType)
```

Sets the schema type of this document, changing the value provided in the constructor.

To successfully index a document, the schema type must match the name of an `https://developer.android.com/reference/android/app/appsearch/AppSearchSchema` object previously provided to `https://developer.android.com/reference/android/app/appsearch/AppSearchSession#setSchema(android.app.appsearch.SetSchemaRequest,%20java.util.concurrent.Executor,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.app.appsearch.AppSearchResult<android.app.appsearch.SetSchemaResponse>>)`.

<br />

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

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

### setScore

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

```
public BuilderType setScore (int score)
```

Sets the score of the `https://developer.android.com/reference/android/app/appsearch/GenericDocument`.

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

Results may be sorted by score using `https://developer.android.com/reference/android/app/appsearch/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. By default, scores are set to 0.

<br />

| Parameters ||
|---|---|
| `score` | `int`: any non-negative `int` representing the document's score. Value is between 0 and `https://developer.android.com/reference/java/lang/Integer#MAX_VALUE` inclusive <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the score is negative. |

### setTtlMillis

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

```
public BuilderType setTtlMillis (long ttlMillis)
```

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

The TTL is measured against `https://developer.android.com/reference/android/app/appsearch/GenericDocument#getCreationTimestampMillis()`. At the timestamp of
`creationTimestampMillis + ttlMillis`, measured in the `https://developer.android.com/reference/java/lang/System#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/android/app/appsearch/AppSearchSession#remove(android.app.appsearch.RemoveByDocumentIdRequest,%20java.util.concurrent.Executor,%20android.app.appsearch.BatchResultCallback<java.lang.String,java.lang.Void>)` is called.

<br />

| Parameters ||
|---|---|
| `ttlMillis` | `long`: a non-negative duration in milliseconds. <br /> |

| Returns ||
|---|---|
| `BuilderType` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if ttlMillis is negative. |