using System; using System.Collections.Generic; namespace Amazon.Lambda.LexV2Events { /// /// A class that represents Kendra Response /// https://docs.aws.amazon.com/kendra/latest/dg/API_Query.html#API_Query_ResponseSyntax /// public class KendraResponse { /// /// Contains the facet results. A FacetResult contains the counts for each /// attribute key that was specified in the Facets input parameter. /// public IList FacetResults { get; set; } /// /// The unique identifier for the search. You use QueryId to identify the /// search when using the feedback API. /// public string QueryId { get; set; } /// /// Gets and sets the property ResultItems. /// /// The results of the search. /// /// public IList ResultItems { get; set; } /// /// A list of information related to suggested spell corrections for a query. /// public IList SpellCorrectedQueries { get; set; } /// /// The total number of items found by the search; however, you can only retrieve up to /// 100 items. For example, if the search found 192 items, you can only retrieve the first /// 100 of the items. /// public int TotalNumberOfResults { get; set; } /// /// A list of warning codes and their messages on problems with your query. /// /// /// Amazon Kendra currently only supports one type of warning, which is a warning on invalid /// syntax used in the query. For examples of invalid query syntax, see Searching /// with advanced query syntax. /// /// public IList Warnings { get; set; } /// /// The facet values for the documents in the response. /// public class FacetResult { /// /// The key for the facet values. This is the same as the DocumentAttributeKey provided in the query. /// public string DocumentAttributeKey { get; set; } /// /// An array of key/value pairs, where the key is the value of the attribute and the count is the number of documents that share the key value. /// public IList DocumentAttributeValueCountPairs { get; set; } /// /// The data type of the facet value. This is the same as the type defined for the index field when it was created. /// public string DocumentAttributeValueType { get; set; } } /// /// Provides the count of documents that match a particular attribute when doing a faceted /// search. /// public class DocumentAttributeValueCountPair { /// /// The number of documents in the response that have the attribute value for the key. /// public int? Count { get; set; } /// /// The value of the attribute. For example, "HR." /// public DocumentAttributeValue DocumentAttributeValue { get; set; } } /// /// The value of a custom document attribute. You can only provide one value for a custom /// attribute. /// public class DocumentAttributeValue { /// /// A date expressed as an ISO 8601 string. /// /// /// It is important for the time zone to be included in the ISO 8601 date-time format. /// For example, 2012-03-25T12:30:10+01:00 is the ISO 8601 date-time format for March /// 25th 2012 at 12:30PM (plus 10 seconds) in Central European Time. /// /// public DateTime? DateValue { get; set; } /// /// A long integer value. /// public long? LongValue { get; set; } /// /// A list of strings. /// public IList StringListValue { get; set; } /// /// A string, such as "department". /// public string StringValue { get; set; } } /// /// A query with suggested spell corrections. /// public class SpellCorrectedQuery { /// /// The corrected misspelled word or words in a query. /// public IList Corrections { get; set; } /// /// The query with the suggested spell corrections. /// public string SuggestedQueryText { get; set; } } /// /// A corrected misspelled word in a query. /// public class Correction { /// /// The zero-based location in the response string or text where the corrected word starts. /// public int? BeginOffset { get; set; } /// /// The string or text of a corrected misspelled word in a query. /// public string CorrectedTerm { get; set; } /// /// The zero-based location in the response string or text where the corrected word ends. /// public int? EndOffset { get; set; } /// /// The string or text of a misspelled word in a query. /// public string Term { get; set; } } /// /// The warning code and message that explains a problem with a query. /// public class Warning { /// /// The code used to show the type of warning for the query. /// public string Code { get; set; } /// /// The message that explains the problem with the query. /// public string Message { get; set; } } /// /// A single query result. /// /// /// /// A query result contains information about a document returned by the query. This includes /// the original location of the document, a list of attributes assigned to the document, /// and relevant text from the document that satisfies the query. /// /// public class QueryResultItem { /// /// Gets and sets the property AdditionalAttributes. /// /// One or more additional attributes associated with the query result. /// /// public IList AdditionalAttributes { get; set; } /// /// An array of document attributes for the document that the query result maps to. For /// example, the document author (Author) or the source URI (SourceUri) of the document. /// public IList DocumentAttributes { get; set; } /// /// An extract of the text in the document. Contains information about highlighting the /// relevant terms in the excerpt. /// public TextWithHighlights DocumentExcerpt { get; set; } /// /// The unique identifier for the document. /// public string DocumentId { get; set; } /// /// The title of the document. Contains the text of the title and information for highlighting /// the relevant terms in the title. /// public TextWithHighlights DocumentTitle { get; set; } /// /// The URI of the original location of the document. /// public string DocumentURI { get; set; } /// /// 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 . /// public string FeedbackToken { get; set; } /// /// The unique identifier for the query result. /// public string Id { get; set; } /// /// Indicates the confidence that Amazon Kendra has that a result matches the query that /// you provided. 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 matches /// the query. /// /// public ScoreAttributes ScoreAttributes { get; set; } /// /// The type of document. /// public string Type { get; set; } } /// /// An attribute returned from an index query. /// public class AdditionalResultAttribute { /// /// The key that identifies the attribute. /// public string Key { get; set; } /// /// An object that contains the attribute value. /// public AdditionalResultAttributeValue Value { get; set; } /// /// The data type of the Value property. /// public string ValueType { get; set; } } /// /// An attribute returned with a document from a search. /// public class AdditionalResultAttributeValue { /// /// The text associated with the attribute and information about the highlight to apply /// to the text. /// public TextWithHighlights TextWithHighlightsValue { get; set; } } /// /// A custom attribute value assigned to a document. /// public class DocumentAttribute { /// /// The identifier for the attribute. /// public string Key { get; set; } /// /// The value of the attribute. /// public DocumentAttributeValue Value { get; set; } } /// /// Provides text and information about where to highlight the text. /// public class TextWithHighlights { /// /// The beginning and end of the text that should be highlighted. /// public IList Highlights { get; set; } /// /// The text to display to the user. /// public string Text { get; set; } } /// /// Provides information that you can use to highlight a search result so that your users /// can quickly identify terms in the response. /// public class Highlight { /// /// The zero-based location in the response string where the highlight starts. /// public int BeginOffset { get; set; } /// /// The zero-based location in the response string where the highlight ends. /// public int EndOffset { get; set; } /// /// Indicates whether the response is the best response. True if this is the best response; /// otherwise, false. /// public bool TopAnswer { get; set; } /// /// The highlight type. /// public string Type { get; set; } } /// /// Provides a relative ranking that indicates how confident Amazon Kendra is that the /// response matches the query. /// public class ScoreAttributes { /// /// A relative ranking for how well the response matches the query. /// public string ScoreConfidence { get; set; } } } }