# ClickAction.BuilderBase

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.BuilderBase) Added in [1.2.0-alpha02](https://developer.android.com/jetpack/androidx/releases/appsearch#1.2.0-alpha02)

*** ** * ** ***


```
@ExperimentalAppSearchApi
public class ClickAction.BuilderBase<T extends ClickAction.BuilderBase<T>> extends TakenAction.BuilderBase<T>
```

<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)\<T\> ||
|   | ↳ | [androidx.appsearch.usagereporting.ClickAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase) |

Known direct subclasses [ClickAction.Builder](https://developer.android.com/reference/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`. |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#BuilderBase(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.BuilderBase` 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.BuilderBase#BuilderBase(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 )` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase` with given `namespace`, `id`, and `actionTimestampMillis`. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase#BuilderBase(java.lang.String,java.lang.String,long,int)( @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, int actionType )` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`. |

| ### Public methods |
|---|---|
| `@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. |

### Inherited methods

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 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

### BuilderBase

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

```
public BuilderBase(@NonNull ClickAction clickAction)
```

Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase` 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. |

### BuilderBase

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

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

Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase` with given `namespace`, `id`, and `actionTimestampMillis`.

The `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.ActionType` for the Document returned from `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction#getActionType()` will be `https://developer.android.com/reference/androidx/appsearch/usagereporting/ActionConstants#ACTION_TYPE_CLICK()`.

| 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. |

### BuilderBase

```
public BuilderBase(
    @NonNull String namespace,
    @NonNull String id,
    long actionTimestampMillis,
    int actionType
)
```

Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`.

| 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. |
| `int actionType` | Action type enum for the Document. See `https://developer.android.com/reference/androidx/appsearch/usagereporting/TakenAction.ActionType`. Value is one of the following: - `ActionConstants.ACTION_TYPE_UNKNOWN` - `ActionConstants.ACTION_TYPE_SEARCH` - `ActionConstants.ACTION_TYPE_CLICK` - `ActionConstants.ACTION_TYPE_IMPRESSION` - `ActionConstants.ACTION_TYPE_DISMISS` <br /> |

## Public methods

### build

```
public @NonNull ClickAction build()
```

Builds a `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction`.

### setQuery

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

```
public @NonNull T setQuery(@Nullable String 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.

### setReferencedQualifiedId

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

```
public @NonNull T setReferencedQualifiedId(@Nullable String referencedQualifiedId)
```

Sets the qualified id of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document that the user takes action on.

A qualified id is a string generated by package, database, namespace, and document id. See `https://developer.android.com/reference/androidx/appsearch/util/DocumentIdUtil#createQualifiedId(java.lang.String,java.lang.String,java.lang.String,java.lang.String)` for more details.

### setResultRankGlobal

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

```
public @NonNull T setResultRankGlobal(int resultRankGlobal)
```

Sets the global rank of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction#getResultRankGlobal()` |   |

### setResultRankInBlock

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

```
public @NonNull T setResultRankInBlock(int resultRankInBlock)
```

Sets the rank of the `https://developer.android.com/reference/androidx/appsearch/app/SearchResult` document among the user-defined block.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ClickAction#getResultRankInBlock()` |   |

### setTimeStayOnResultMillis

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

```
public @NonNull T setTimeStayOnResultMillis(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.