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

*** ** * ** ***


```
@ExperimentalAppSearchApi
class SearchAction.BuilderBase<T : SearchAction.BuilderBase<T!>?> : TakenAction.BuilderBase<T!>
```

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

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

*** ** * ** ***

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.BuilderBase#BuilderBase(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.BuilderBase` with all the existing values. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase#BuilderBase(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)` Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase` with given `namespace`, `id`, and `actionTimestampMillis`. |
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase#BuilderBase(java.lang.String,java.lang.String,long,int)( 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, actionType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Constructs `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction.BuilderBase` with given `namespace`, `id`, `actionTimestampMillis` and `actionType`. |

| ### Public functions |
|---|---|
| `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). |

### Inherited functions

From [androidx.appsearch.usagereporting.TakenAction.BuilderBase](https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/TakenAction.BuilderBase) `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

### BuilderBase

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

```
BuilderBase(searchAction: SearchAction)
```

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

### BuilderBase

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

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

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

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

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

### BuilderBase

```
BuilderBase(
    namespace: String,
    id: String,
    actionTimestampMillis: Long,
    actionType: Int
)
```

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

| 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. |
| `actionType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Action type enum for the Document. See `https://developer.android.com/reference/kotlin/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 functions

### build

```
fun build(): SearchAction
```

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

### setFetchedResultCount

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

```
fun setFetchedResultCount(fetchedResultCount: Int): T
```

Sets total number of results fetched from AppSearch by the client in this `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction`.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/usagereporting/SearchAction#getFetchedResultCount()` |   |

### setQuery

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

```
fun setQuery(query: String?): T
```

Sets the user-entered search input (without any operators or rewriting).