ImpressionAction.Builder


@Document.BuilderProducer
class ImpressionAction.Builder


Builder for ImpressionAction.

Summary

Public constructors

Builder(impressionAction: ImpressionAction)

Constructs ImpressionAction.Builder by copying existing values from the given ImpressionAction.

Builder(namespace: String, id: String, actionTimestampMillis: Long)

Constructor for ImpressionAction.Builder.

Public functions

ImpressionAction

Builds an ImpressionAction.

TakenAction

For AppSearch annotation processor requirement only.

T
setDocumentTtlMillis(documentTtlMillis: Long)

Sets the time-to-live (TTL) of the TakenAction document as a duration in milliseconds.

T
setQuery(query: String?)

Sets the user-entered search input (without any operators or rewriting) that yielded the androidx.appsearch.app.SearchResult which impressed the user.

T
setReferencedQualifiedId(referencedQualifiedId: String?)

Sets the qualified id of the androidx.appsearch.app.SearchResult document that the user takes action on.

T
setResultRankGlobal(resultRankGlobal: Int)

Sets the global rank of the androidx.appsearch.app.SearchResult document.

T
setResultRankInBlock(resultRankInBlock: Int)

Sets the rank of the androidx.appsearch.app.SearchResult document among the user-defined block.

Public constructors

Builder

Added in 1.1.0
Builder(impressionAction: ImpressionAction)

Constructs ImpressionAction.Builder by copying existing values from the given ImpressionAction.

Parameters
impressionAction: ImpressionAction

an existing ImpressionAction object.

Builder

Added in 1.1.0
Builder(namespace: String, id: String, actionTimestampMillis: Long)

Constructor for ImpressionAction.Builder.

Parameters
namespace: String

Namespace for the Document. See Document.Namespace.

id: String

Unique identifier for the Document. See Document.Id.

actionTimestampMillis: Long

The timestamp when the user took the action, in milliseconds since Unix epoch.

Public functions

build

Added in 1.1.0
fun build(): ImpressionAction

Builds an ImpressionAction.

build

Added in 1.1.0
fun build(): TakenAction

For AppSearch annotation processor requirement only. The client should never call it since it is impossible to instantiate an abstract class.

setDocumentTtlMillis

Added in 1.1.0
fun setDocumentTtlMillis(documentTtlMillis: Long): T

Sets the time-to-live (TTL) of the TakenAction document as a duration in milliseconds.

The document will be automatically deleted when the TTL expires (since getActionTimestampMillis).

The default TTL for TakenAction document is 60 days.

See androidx.appsearch.annotation.Document.TtlMillis for more information on TTL.

setQuery

Added in 1.1.0
fun setQuery(query: String?): T

Sets the user-entered search input (without any operators or rewriting) that yielded the androidx.appsearch.app.SearchResult which impressed the user.

setReferencedQualifiedId

Added in 1.1.0
fun setReferencedQualifiedId(referencedQualifiedId: String?): T

Sets the qualified id of the 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 createQualifiedId for more details.

setResultRankGlobal

Added in 1.1.0
fun setResultRankGlobal(resultRankGlobal: Int): T

Sets the global rank of the androidx.appsearch.app.SearchResult document.

setResultRankInBlock

Added in 1.1.0
fun setResultRankInBlock(resultRankInBlock: Int): T

Sets the rank of the androidx.appsearch.app.SearchResult document among the user-defined block.