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

*** ** * ** ***


```
@ExperimentalAppSearchApi
public class ImpressionAction.BuilderBase<T extends ImpressionAction.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.ImpressionAction.BuilderBase](https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase) |

Known direct subclasses [ImpressionAction.Builder](https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.Builder)

|---|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.Builder` | Builder for `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction`. |

*** ** * ** ***

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

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase#BuilderBase(androidx.appsearch.usagereporting.ImpressionAction)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction impressionAction)` Constructs `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase` by copying existing values from the given `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction`. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.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/ImpressionAction.BuilderBase` with given `namespace`, `id`, and `actionTimestampMillis`. |
| `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.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/ImpressionAction.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/ImpressionAction` | `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.BuilderBase#build()()` Builds an `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.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` which impressed the user. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html T` | `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction.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/ImpressionAction.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/ImpressionAction.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. |

### 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 ImpressionAction impressionAction)
```

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

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction impressionAction` | an existing `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction` 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/ImpressionAction.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_IMPRESSION()`.

| 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/ImpressionAction.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 ImpressionAction build()
```

Builds an `https://developer.android.com/reference/androidx/appsearch/usagereporting/ImpressionAction`.

### 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` which impressed the user.

### 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/ImpressionAction#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/ImpressionAction#getResultRankInBlock()` |   |