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

*** ** * ** ***


```
@Document.BuilderProducer
public final class ClickAction.Builder extends ClickAction.BuilderBase<ClickAction.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.ClickAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase)\<[ClickAction.Builder](https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.Builder)\> ||
|   |   | ↳ | [androidx.appsearch.usagereporting.ClickAction.Builder](https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.Builder) |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.Builder#Builder(androidx.appsearch.usagereporting.ClickAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction clickAction)` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.Builder` by copying existing values from the given `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction`. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.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/ClickAction.Builder`. |

### Inherited methods

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

Builds a `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.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) that yielded the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` on which the user clicked.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#setReferencedQualifiedId(java.lang.String)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html referencedQualifiedId)`

Sets the qualified id of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document that the user takes action on.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#setResultRankGlobal(int)(int resultRankGlobal)`

Sets the global rank of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#setResultRankInBlock(int)(int resultRankInBlock)`

Sets the rank of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document among the user-defined block.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#setTimeStayOnResultMillis(long)(long timeStayOnResultMillis)`

Sets the time in milliseconds that user stays on the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document after clicking it.
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 ClickAction clickAction)
```

Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.Builder` by copying existing values from the given `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction clickAction` | an existing `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction` object. |

### 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/ClickAction.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. |