ImpressionAction.Builder


@Document.BuilderProducer
public final class ImpressionAction.Builder


Builder for ImpressionAction.

Summary

Protected fields

long
int
long
final String
final String

Public constructors

Builder(@NonNull ImpressionAction impressionAction)

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

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

Constructor for ImpressionAction.Builder.

Public methods

@NonNull ImpressionAction

Builds an ImpressionAction.

@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

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

@NonNull ImpressionAction.Builder

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

@NonNull ImpressionAction.Builder
setReferencedQualifiedId(@Nullable String referencedQualifiedId)

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

@NonNull ImpressionAction.Builder
setResultRankGlobal(int resultRankGlobal)

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

@NonNull ImpressionAction.Builder
setResultRankInBlock(int resultRankInBlock)

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

Protected fields

mActionTimestampMillis

protected long mActionTimestampMillis

mActionType

protected int mActionType

mDocumentTtlMillis

protected long mDocumentTtlMillis

mId

protected final String mId

mNamespace

protected final String mNamespace

Public constructors

Builder

Added in 1.1.0-alpha07
public Builder(@NonNull ImpressionAction impressionAction)

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

Parameters
@NonNull ImpressionAction impressionAction

an existing ImpressionAction object.

Builder

Added in 1.1.0-alpha07
public Builder(
    @NonNull String namespace,
    @NonNull String id,
    long actionTimestampMillis
)

Constructor for ImpressionAction.Builder.

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.

Public methods

build

Added in 1.1.0-alpha07
public @NonNull ImpressionAction build()

Builds an ImpressionAction.

setDocumentTtlMillis

Added in 1.1.0-alpha07
public @NonNullsetDocumentTtlMillis(long documentTtlMillis)

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-alpha07
public @NonNull ImpressionAction.Builder setQuery(@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.1.0-alpha07
public @NonNull ImpressionAction.Builder setReferencedQualifiedId(@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.1.0-alpha07
public @NonNull ImpressionAction.Builder setResultRankGlobal(int resultRankGlobal)

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

setResultRankInBlock

Added in 1.1.0-alpha07
public @NonNull ImpressionAction.Builder setResultRankInBlock(int resultRankInBlock)

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