ClickAction.BuilderBase


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

Known direct subclasses

Builder for ClickAction.

Summary

Public constructors

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

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

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

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

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

Public methods

@NonNull ClickAction

Builds a ClickAction.

@NonNull T

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

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

@NonNull T
setTimeStayOnResultMillis(long timeStayOnResultMillis)

Sets the time in milliseconds that user stays on the androidx.appsearch.app.SearchResult document after clicking it.

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 ClickAction clickAction)

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

Parameters
@NonNull ClickAction clickAction

an existing ClickAction object.

BuilderBase

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

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

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

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 ClickAction.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 ClickAction build()

Builds a ClickAction.

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 on which the user clicked.

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.

setTimeStayOnResultMillis

Added in 1.2.0-alpha02
public @NonNullsetTimeStayOnResultMillis(long timeStayOnResultMillis)

Sets the time in milliseconds that user stays on the androidx.appsearch.app.SearchResult document after clicking it.