# SearchAction.Builder

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

*** ** * ** ***


```
@Document.BuilderProducer
class SearchAction.Builder : SearchAction.BuilderBase<SearchAction.Builder!>
```

<br />

|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) ||||
| ↳ | [androidx.appsearch.usagereporting.TakenAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase) |||
|   | ↳ | [androidx.appsearch.usagereporting.SearchAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase)\<[SearchAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder)!\> ||
|   |   | ↳ | [androidx.appsearch.usagereporting.SearchAction.Builder](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder) |

*** ** * ** ***

Builder for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder#Builder(androidx.appsearch.usagereporting.SearchAction)(searchAction: https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder` with all the existing values. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder#Builder(java.lang.String,java.lang.String,long)(namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, actionTimestampMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)` Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder`. |

### Inherited functions

From [androidx.appsearch.usagereporting.SearchAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase) `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction` `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase#build()()`

Builds a `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase#setFetchedResultCount(int)(fetchedResultCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets total number of results fetched from AppSearch by the client in this `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase#setQuery(java.lang.String)(query: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html?)`

Sets the user-entered search input (without any operators or rewriting).
From [androidx.appsearch.usagereporting.TakenAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase) `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#build()()`

For AppSearch annotation processor requirement only.
`T` `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase#setDocumentTtlMillis(long)(documentTtlMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`

Sets the time-to-live (TTL) of the `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction` document as a duration in milliseconds.

## Public constructors

### Builder

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

```
Builder(searchAction: SearchAction)
```

Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder` with all the existing values.

### Builder

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

```
Builder(namespace: String, id: String, actionTimestampMillis: Long)
```

Constructor for `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.Builder`.

| Parameters |
|---|---|
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Namespace for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Namespace`. |
| `id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | Unique identifier for the Document. See `https://developer.android.com/reference/kotlin/androidx/appsearch/annotation/Document.Id`. |
| `actionTimestampMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The timestamp when the user took the action, in milliseconds since Unix epoch. |