SearchAction.Builder


@Document.BuilderProducer
public final class SearchAction.Builder


Builder for SearchAction.

Summary

Protected fields

long
int
long
final String
final String

Public constructors

Builder(@NonNull SearchAction searchAction)

Constructor for Builder with all the existing values.

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

Constructor for SearchAction.Builder.

Public methods

@NonNull SearchAction

Builds a SearchAction.

@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

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

@NonNull SearchAction.Builder
setFetchedResultCount(int fetchedResultCount)

Sets total number of results fetched from AppSearch by the client in this SearchAction.

@NonNull SearchAction.Builder

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

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 SearchAction searchAction)

Constructor for Builder with all the existing values.

Builder

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

Constructor for SearchAction.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 SearchAction build()

Builds a SearchAction.

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.

setFetchedResultCount

Added in 1.1.0-alpha07
public @NonNull SearchAction.Builder setFetchedResultCount(int fetchedResultCount)

Sets total number of results fetched from AppSearch by the client in this SearchAction.

setQuery

Added in 1.1.0-alpha07
public @NonNull SearchAction.Builder setQuery(@Nullable String query)

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