SearchAction.Builder


@Document.BuilderProducer
class SearchAction.Builder


Builder for SearchAction.

Summary

Public constructors

Builder(searchAction: SearchAction)

Constructor for SearchAction.Builder with all the existing values.

Builder(namespace: String, id: String, actionTimestampMillis: Long)

Constructor for SearchAction.Builder.

Public functions

SearchAction

Builds a SearchAction.

TakenAction

For AppSearch annotation processor requirement only.

T
setDocumentTtlMillis(documentTtlMillis: Long)

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

T
setFetchedResultCount(fetchedResultCount: Int)

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

T
setQuery(query: String?)

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

Public constructors

Builder

Added in 1.1.0
Builder(searchAction: SearchAction)

Constructor for SearchAction.Builder with all the existing values.

Builder

Added in 1.1.0
Builder(namespace: String, id: String, actionTimestampMillis: Long)

Constructor for SearchAction.Builder.

Parameters
namespace: String

Namespace for the Document. See Document.Namespace.

id: String

Unique identifier for the Document. See Document.Id.

actionTimestampMillis: Long

The timestamp when the user took the action, in milliseconds since Unix epoch.

Public functions

build

Added in 1.1.0
fun build(): SearchAction

Builds a SearchAction.

build

Added in 1.1.0
fun build(): TakenAction

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
fun setDocumentTtlMillis(documentTtlMillis: Long): T

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
fun setFetchedResultCount(fetchedResultCount: Int): T

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

setQuery

Added in 1.1.0
fun setQuery(query: String?): T

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