ImpressionAction.BuilderBase


@ExperimentalAppSearchApi
public class ImpressionAction.BuilderBase<T extends ImpressionAction.BuilderBase<T>> extends TakenAction.BuilderBase


Builder for ImpressionAction.

Summary

Public constructors

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

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

Constructs ImpressionAction.BuilderBase with given namespace, id, and actionTimestampMillis.

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

Constructs ImpressionAction.BuilderBase with given namespace, id, actionTimestampMillis and actionType.

Public methods

@NonNull ImpressionAction

Builds an ImpressionAction.

@NonNull T

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

@NonNull T
setReferencedQualifiedId(@Nullable String referencedQualifiedId)

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

@NonNull T
setResultRankGlobal(int resultRankGlobal)

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

@NonNull T
setResultRankInBlock(int resultRankInBlock)

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

Inherited methods

From androidx.appsearch.usagereporting.TakenAction.BuilderBase
@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

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

Public constructors

BuilderBase

Added in 1.2.0-alpha02
public BuilderBase(@NonNull ImpressionAction impressionAction)

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

Parameters
@NonNull ImpressionAction impressionAction

an existing ImpressionAction object.

BuilderBase

Added in 1.2.0-alpha02
public BuilderBase(
    @NonNull String namespace,
    @NonNull String id,
    long actionTimestampMillis
)

Constructs ImpressionAction.BuilderBase with given namespace, id, and actionTimestampMillis.

The TakenAction.ActionType for the Document returned from getActionType will be ACTION_TYPE_IMPRESSION.

Parameters
@NonNull String namespace

Namespace for the Document. See Document.Namespace.

@NonNull String id

Unique identifier for the Document. See 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 ImpressionAction.BuilderBase with given namespace, id, actionTimestampMillis and actionType.

Parameters
@NonNull String namespace

Namespace for the Document. See Document.Namespace.

@NonNull String id

Unique identifier for the Document. See 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 TakenAction.ActionType.

Public methods

build

public @NonNull ImpressionAction build()

Builds an ImpressionAction.

setQuery

Added in 1.2.0-alpha02
public @NonNullsetQuery(@Nullable String query)

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.2.0-alpha02
public @NonNullsetReferencedQualifiedId(@Nullable String referencedQualifiedId)

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.2.0-alpha02
public @NonNullsetResultRankGlobal(int resultRankGlobal)

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

setResultRankInBlock

Added in 1.2.0-alpha02
public @NonNullsetResultRankInBlock(int resultRankInBlock)

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