Interface QueryResultItem.Builder

    • Method Detail

      • id

        QueryResultItem.Builder id​(String id)

        The unique identifier for the query result item id (Id) and the query result item document id ( DocumentId) combined. The value of this field changes with every request, even when you have the same documents.

        Parameters:
        id - The unique identifier for the query result item id (Id) and the query result item document id (DocumentId) combined. The value of this field changes with every request, even when you have the same documents.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • type

        QueryResultItem.Builder type​(String type)

        The type of document within the response. For example, a response could include a question-answer that's relevant to the query.

        Parameters:
        type - The type of document within the response. For example, a response could include a question-answer that's relevant to the query.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        QueryResultType, QueryResultType
      • type

        QueryResultItem.Builder type​(QueryResultType type)

        The type of document within the response. For example, a response could include a question-answer that's relevant to the query.

        Parameters:
        type - The type of document within the response. For example, a response could include a question-answer that's relevant to the query.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        QueryResultType, QueryResultType
      • format

        QueryResultItem.Builder format​(String format)

        If the Type of document within the response is ANSWER, then it is either a TABLE answer or TEXT answer. If it's a table answer, a table excerpt is returned in TableExcerpt. If it's a text answer, a text excerpt is returned in DocumentExcerpt.

        Parameters:
        format - If the Type of document within the response is ANSWER, then it is either a TABLE answer or TEXT answer. If it's a table answer, a table excerpt is returned in TableExcerpt. If it's a text answer, a text excerpt is returned in DocumentExcerpt.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        QueryResultFormat, QueryResultFormat
      • format

        QueryResultItem.Builder format​(QueryResultFormat format)

        If the Type of document within the response is ANSWER, then it is either a TABLE answer or TEXT answer. If it's a table answer, a table excerpt is returned in TableExcerpt. If it's a text answer, a text excerpt is returned in DocumentExcerpt.

        Parameters:
        format - If the Type of document within the response is ANSWER, then it is either a TABLE answer or TEXT answer. If it's a table answer, a table excerpt is returned in TableExcerpt. If it's a text answer, a text excerpt is returned in DocumentExcerpt.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        QueryResultFormat, QueryResultFormat
      • additionalAttributes

        QueryResultItem.Builder additionalAttributes​(Collection<AdditionalResultAttribute> additionalAttributes)

        One or more additional fields/attributes associated with the query result.

        Parameters:
        additionalAttributes - One or more additional fields/attributes associated with the query result.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • additionalAttributes

        QueryResultItem.Builder additionalAttributes​(AdditionalResultAttribute... additionalAttributes)

        One or more additional fields/attributes associated with the query result.

        Parameters:
        additionalAttributes - One or more additional fields/attributes associated with the query result.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentId

        QueryResultItem.Builder documentId​(String documentId)

        The identifier for the document.

        Parameters:
        documentId - The identifier for the document.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentTitle

        QueryResultItem.Builder documentTitle​(TextWithHighlights documentTitle)

        The title of the document. Contains the text of the title and information for highlighting the relevant terms in the title.

        Parameters:
        documentTitle - The title of the document. Contains the text of the title and information for highlighting the relevant terms in the title.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentExcerpt

        QueryResultItem.Builder documentExcerpt​(TextWithHighlights documentExcerpt)

        An extract of the text in the document. Contains information about highlighting the relevant terms in the excerpt.

        Parameters:
        documentExcerpt - An extract of the text in the document. Contains information about highlighting the relevant terms in the excerpt.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentURI

        QueryResultItem.Builder documentURI​(String documentURI)

        The URI of the original location of the document.

        Parameters:
        documentURI - The URI of the original location of the document.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentAttributes

        QueryResultItem.Builder documentAttributes​(Collection<DocumentAttribute> documentAttributes)

        An array of document fields/attributes assigned to a document in the search results. For example, the document author (_author) or the source URI (_source_uri) of the document.

        Parameters:
        documentAttributes - An array of document fields/attributes assigned to a document in the search results. For example, the document author (_author) or the source URI (_source_uri) of the document.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentAttributes

        QueryResultItem.Builder documentAttributes​(DocumentAttribute... documentAttributes)

        An array of document fields/attributes assigned to a document in the search results. For example, the document author (_author) or the source URI (_source_uri) of the document.

        Parameters:
        documentAttributes - An array of document fields/attributes assigned to a document in the search results. For example, the document author (_author) or the source URI (_source_uri) of the document.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • documentAttributes

        QueryResultItem.Builder documentAttributes​(Consumer<DocumentAttribute.Builder>... documentAttributes)

        An array of document fields/attributes assigned to a document in the search results. For example, the document author (_author) or the source URI (_source_uri) of the document.

        This is a convenience method that creates an instance of the DocumentAttribute.Builder avoiding the need to create one manually via DocumentAttribute.builder().

        When the Consumer completes, SdkBuilder.build() is called immediately and its result is passed to #documentAttributes(List).

        Parameters:
        documentAttributes - a consumer that will call methods on DocumentAttribute.Builder
        Returns:
        Returns a reference to this object so that method calls can be chained together.
        See Also:
        #documentAttributes(java.util.Collection)
      • scoreAttributes

        QueryResultItem.Builder scoreAttributes​(ScoreAttributes scoreAttributes)

        Indicates the confidence level of Amazon Kendra providing a relevant result for the query. Each result is placed into a bin that indicates the confidence, VERY_HIGH, HIGH, MEDIUM and LOW. You can use the score to determine if a response meets the confidence needed for your application.

        The field is only set to LOW when the Type field is set to DOCUMENT and Amazon Kendra is not confident that the result is relevant to the query.

        Parameters:
        scoreAttributes - Indicates the confidence level of Amazon Kendra providing a relevant result for the query. Each result is placed into a bin that indicates the confidence, VERY_HIGH, HIGH, MEDIUM and LOW. You can use the score to determine if a response meets the confidence needed for your application.

        The field is only set to LOW when the Type field is set to DOCUMENT and Amazon Kendra is not confident that the result is relevant to the query.

        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • feedbackToken

        QueryResultItem.Builder feedbackToken​(String feedbackToken)

        A token that identifies a particular result from a particular query. Use this token to provide click-through feedback for the result. For more information, see Submitting feedback.

        Parameters:
        feedbackToken - A token that identifies a particular result from a particular query. Use this token to provide click-through feedback for the result. For more information, see Submitting feedback.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • tableExcerpt

        QueryResultItem.Builder tableExcerpt​(TableExcerpt tableExcerpt)

        An excerpt from a table within a document.

        Parameters:
        tableExcerpt - An excerpt from a table within a document.
        Returns:
        Returns a reference to this object so that method calls can be chained together.
      • collapsedResultDetail

        QueryResultItem.Builder collapsedResultDetail​(CollapsedResultDetail collapsedResultDetail)

        Provides details about a collapsed group of search results.

        Parameters:
        collapsedResultDetail - Provides details about a collapsed group of search results.
        Returns:
        Returns a reference to this object so that method calls can be chained together.