SearchAction.Builder


@Document.BuilderProducer
public final class SearchAction.Builder


Builder for SearchAction.

Summary

Public constructors

Builder(@NonNull SearchAction searchAction)

Constructor for SearchAction.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 TakenAction

For AppSearch annotation processor requirement only.

@NonNull T
setDocumentTtlMillis(long documentTtlMillis)

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

@NonNull T
setFetchedResultCount(int fetchedResultCount)

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

@NonNull T

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

Public constructors

Builder

Added in 1.1.0
public Builder(@NonNull SearchAction searchAction)

Constructor for SearchAction.Builder with all the existing values.

Builder

Added in 1.1.0
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
public @NonNull SearchAction build()

Builds a SearchAction.

build

Added in 1.1.0
public @NonNull TakenAction build()

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
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
public @NonNullsetFetchedResultCount(int fetchedResultCount)

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

setQuery

Added in 1.1.0
public @NonNullsetQuery(@Nullable String query)

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