# 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
public final class SearchAction.Builder extends SearchAction.BuilderBase<SearchAction.Builder>
```

<br />

|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||||
| ↳ | [androidx.appsearch.usagereporting.TakenAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase) |||
|   | ↳ | [androidx.appsearch.usagereporting.SearchAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.BuilderBase)\<[SearchAction.Builder](https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder)\> ||
|   |   | ↳ | [androidx.appsearch.usagereporting.SearchAction.Builder](https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder) |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder#Builder(androidx.appsearch.usagereporting.SearchAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction searchAction)` Constructor for `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder` with all the existing values. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder#Builder(java.lang.String,java.lang.String,long)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id, long actionTimestampMillis )` Constructor for `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.Builder`. |

### Inherited methods

From [androidx.appsearch.usagereporting.SearchAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.BuilderBase) `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction` `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.BuilderBase#build()()`

Builds a `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.BuilderBase#setFetchedResultCount(int)(int fetchedResultCount)`

Sets total number of results fetched from AppSearch by the client in this `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/SearchAction.BuilderBase#setQuery(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html query)`

Sets the user-entered search input (without any operators or rewriting).
From [androidx.appsearch.usagereporting.TakenAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase) `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction` `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#build()()`

For AppSearch annotation processor requirement only.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.BuilderBase#setDocumentTtlMillis(long)(long documentTtlMillis)`

Sets the time-to-live (TTL) of the `https://developer.android.com/reference/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)

```
public Builder(@NonNull SearchAction searchAction)
```

Constructor for `https://developer.android.com/reference/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)

```
public Builder(
    @NonNull String namespace,
    @NonNull String id,
    long actionTimestampMillis
)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html namespace` | Namespace for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Namespace`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html id` | Unique identifier for the Document. See `https://developer.android.com/reference/androidx/appsearch/annotation/Document.Id`. |
| `long actionTimestampMillis` | The timestamp when the user took the action, in milliseconds since Unix epoch. |