PutDocumentsRequest.Builder


class PutDocumentsRequest.Builder


Builder for PutDocumentsRequest objects.

Summary

Public constructors

Public functions

PutDocumentsRequest.Builder
addDocuments(documents: Array<Any!>)

Adds one or more annotated androidx.appsearch.annotation.Document documents to the request.

PutDocumentsRequest.Builder

Adds a collection of annotated androidx.appsearch.annotation.Document documents to the request.

PutDocumentsRequest.Builder

Adds one or more GenericDocument objects to the request.

PutDocumentsRequest.Builder

Adds a collection of GenericDocument objects to the request.

PutDocumentsRequest.Builder

Adds one or more TakenAction objects to the request.

PutDocumentsRequest.Builder

Adds a collection of TakenAction objects to the request.

PutDocumentsRequest

Creates a new PutDocumentsRequest object.

Public constructors

Builder

Added in 1.1.0-alpha07
Builder()

Public functions

addDocuments

fun addDocuments(documents: Array<Any!>): PutDocumentsRequest.Builder

Adds one or more annotated androidx.appsearch.annotation.Document documents to the request.

Parameters
documents: Array<Any!>

annotated androidx.appsearch.annotation.Document documents.

Throws
androidx.appsearch.exceptions.AppSearchException

if an error occurs converting a document class into a GenericDocument.

addDocuments

Added in 1.1.0-alpha07
fun addDocuments(documents: (Mutable)Collection<Any!>): PutDocumentsRequest.Builder

Adds a collection of annotated androidx.appsearch.annotation.Document documents to the request.

Parameters
documents: (Mutable)Collection<Any!>

annotated androidx.appsearch.annotation.Document documents.

Throws
androidx.appsearch.exceptions.AppSearchException

if an error occurs converting a document into a GenericDocument.

addGenericDocuments

fun addGenericDocuments(documents: Array<GenericDocument!>): PutDocumentsRequest.Builder

Adds one or more GenericDocument objects to the request.

addGenericDocuments

Added in 1.1.0-alpha07
fun addGenericDocuments(documents: (Mutable)Collection<GenericDocument!>): PutDocumentsRequest.Builder

Adds a collection of GenericDocument objects to the request.

addTakenActions

@ExperimentalAppSearchApi
fun addTakenActions(takenActions: Array<TakenAction!>): PutDocumentsRequest.Builder

Adds one or more TakenAction objects to the request.

Clients can construct TakenAction documents to report the user's actions on search results, and these actions can be used as signals to boost result ranking in future search requests. See TakenAction for more details.

Clients should report search and click actions together sorted by getActionTimestampMillis in chronological order.

For example, if there are 2 search actions, with 1 click action associated with the first and 2 click actions associated with the second, then clients should report [searchAction1, clickAction1, searchAction2, clickAction2, clickAction3].

Certain anonymized information about actions reported using this API may be uploaded using statsd and may be used to improve the quality of the search algorithms. Most of the information in this class is already non-identifiable, such as durations and its position in the result set. Identifiable information which you choose to provide, such as the query string, will be anonymized using techniques like Federated Analytics to ensure only the most frequently searched terms across the whole user population are retained and available for study.

You can alternatively use the addDocuments API with TakenAction document to retain the benefits of joining and using it on-device, without triggering any of the anonymized stats uploading described above.

Parameters
takenActions: Array<TakenAction!>

one or more TakenAction objects.

addTakenActions

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun addTakenActions(takenActions: (Mutable)Collection<TakenAction!>): PutDocumentsRequest.Builder

Adds a collection of TakenAction objects to the request.

Parameters
takenActions: (Mutable)Collection<TakenAction!>

a collection of TakenAction objects.

See also
addTakenActions

build

Added in 1.1.0-alpha07
fun build(): PutDocumentsRequest

Creates a new PutDocumentsRequest object.

Throws
java.lang.IllegalArgumentException

if there is any id collision between normal and action documents.