PutDocumentsRequest.Builder

public static final classPutDocumentsRequest.BuilderextendsObject

Builder forPutDocumentsRequest objects.

Public Constructor Summary

Public Method Summary

PutDocumentsRequest.Builder
addGenericDocuments(Collection<? extendsGenericDocument> documents)
Adds a collection ofGenericDocument objects to the request.
PutDocumentsRequest.Builder
addGenericDocuments(GenericDocument... documents)
Adds one or moreGenericDocument objects to the request.
PutDocumentsRequest.Builder
addTakenActionGenericDocuments(GenericDocument... takenActionGenericDocuments)
Adds one or moreGenericDocument objects containing taken action metrics to the request.
PutDocumentsRequest.Builder
addTakenActionGenericDocuments(Collection<? extendsGenericDocument> takenActionGenericDocuments)
Adds a collection ofGenericDocument objects containing taken action metrics to the request.
PutDocumentsRequest
build()
Creates a newPutDocumentsRequest object.

Inherited Method Summary

Public Constructors

publicBuilder()

Public Methods

publicPutDocumentsRequest.Builder addGenericDocuments(Collection<? extendsGenericDocument> documents)

Adds a collection ofGenericDocument objects to the request.

publicPutDocumentsRequest.Builder addGenericDocuments(GenericDocument... documents)

Adds one or moreGenericDocument objects to the request.

publicPutDocumentsRequest.Builder addTakenActionGenericDocuments(GenericDocument... takenActionGenericDocuments)

Adds one or moreGenericDocument objects containing taken action metrics to the request.

Metrics to be collected by AppSearch:

  • name: STRING, the name of the taken action.

    Name is an optional custom field that allows the client to tag and categorize taken actionGenericDocument.

  • referencedQualifiedId: STRING, the qualified id of theSearchResult document that the user takes action on.

    A qualified id is a string generated by package, database, namespace, and document id. See DocumentIdUtil.createQualifiedId(String, String, GenericDocument)for more details.

  • previousQueries: REPEATED STRING, the list of all previous user-entered search inputs, without any operators or rewriting, collected during this search session in chronological order.
  • finalQuery: STRING, the final user-entered search input (without any operators or rewriting) that yielded theSearchResult on which the user took action.
  • resultRankInBlock: LONG, the rank of theSearchResult document among the user-defined block.

    The client can define its own custom definition for block, for example, corpus name, group, etc.

    For example, a client defines the block as corpus, and AppSearch returns 5 documents with corpus = [ "corpus1", "corpus1", "corpus2", "corpus3", "corpus2" ]. Then the block ranks of them = [1, 2, 1, 1, 2].

    If the client is not presenting the results in multiple blocks, they should set this value to match resultRankGlobal.

  • resultRankGlobal: LONG, the global rank of theSearchResult document.

    Global rank reflects the order ofSearchResult documents returned by AppSearch.

    For example, AppSearch returns 2 pages with 10SearchResult documents for each page. Then the global ranks of them will be 1 to 10 for the first page, and 11 to 20 for the second page.

  • timeStayOnResultMillis: LONG, the time in milliseconds that user stays on the SearchResult document after clicking it.

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 addGenericDocuments(GenericDocument)API to retain the benefits of joining and using it on-device, without triggering any of the anonymized stats uploading described above.

Parameters
takenActionGenericDocuments one or moreGenericDocument objects containing taken action metric fields.

publicPutDocumentsRequest.Builder addTakenActionGenericDocuments(Collection<? extendsGenericDocument> takenActionGenericDocuments)

Adds a collection ofGenericDocument objects containing taken action metrics to the request.

Parameters
takenActionGenericDocuments a collection ofGenericDocument objects containing taken action metric fields.

publicPutDocumentsRequest build()

Creates a newPutDocumentsRequest object.

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