1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct QueryOutput {
    /// <p>The identifier for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">SubmitFeedback</a> API.</p>
    pub query_id: ::std::option::Option<::std::string::String>,
    /// <p>The results of the search.</p>
    pub result_items: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>,
    /// <p>Contains the facet results. A <code>FacetResult</code> contains the counts for each field/attribute key that was specified in the <code>Facets</code> input parameter.</p>
    pub facet_results: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>,
    /// <p>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.</p>
    pub total_number_of_results: ::std::option::Option<i32>,
    /// <p>A list of warning codes and their messages on problems with your query.</p>
    /// <p>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 <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a>.</p>
    pub warnings: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>,
    /// <p>A list of information related to suggested spell corrections for a query.</p>
    pub spell_corrected_queries: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>,
    /// <p>The list of featured result items. Featured results are displayed at the top of the search results page, placed above all other results for certain queries. If there's an exact match of a query, then certain documents are featured in the search results.</p>
    pub featured_results_items: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>,
    _request_id: Option<String>,
}
impl QueryOutput {
    /// <p>The identifier for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">SubmitFeedback</a> API.</p>
    pub fn query_id(&self) -> ::std::option::Option<&str> {
        self.query_id.as_deref()
    }
    /// <p>The results of the search.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.result_items.is_none()`.
    pub fn result_items(&self) -> &[crate::types::QueryResultItem] {
        self.result_items.as_deref().unwrap_or_default()
    }
    /// <p>Contains the facet results. A <code>FacetResult</code> contains the counts for each field/attribute key that was specified in the <code>Facets</code> input parameter.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.facet_results.is_none()`.
    pub fn facet_results(&self) -> &[crate::types::FacetResult] {
        self.facet_results.as_deref().unwrap_or_default()
    }
    /// <p>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.</p>
    pub fn total_number_of_results(&self) -> ::std::option::Option<i32> {
        self.total_number_of_results
    }
    /// <p>A list of warning codes and their messages on problems with your query.</p>
    /// <p>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 <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a>.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.warnings.is_none()`.
    pub fn warnings(&self) -> &[crate::types::Warning] {
        self.warnings.as_deref().unwrap_or_default()
    }
    /// <p>A list of information related to suggested spell corrections for a query.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.spell_corrected_queries.is_none()`.
    pub fn spell_corrected_queries(&self) -> &[crate::types::SpellCorrectedQuery] {
        self.spell_corrected_queries.as_deref().unwrap_or_default()
    }
    /// <p>The list of featured result items. Featured results are displayed at the top of the search results page, placed above all other results for certain queries. If there's an exact match of a query, then certain documents are featured in the search results.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.featured_results_items.is_none()`.
    pub fn featured_results_items(&self) -> &[crate::types::FeaturedResultsItem] {
        self.featured_results_items.as_deref().unwrap_or_default()
    }
}
impl ::aws_types::request_id::RequestId for QueryOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl QueryOutput {
    /// Creates a new builder-style object to manufacture [`QueryOutput`](crate::operation::query::QueryOutput).
    pub fn builder() -> crate::operation::query::builders::QueryOutputBuilder {
        crate::operation::query::builders::QueryOutputBuilder::default()
    }
}

/// A builder for [`QueryOutput`](crate::operation::query::QueryOutput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct QueryOutputBuilder {
    pub(crate) query_id: ::std::option::Option<::std::string::String>,
    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>,
    pub(crate) facet_results: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>,
    pub(crate) total_number_of_results: ::std::option::Option<i32>,
    pub(crate) warnings: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>,
    pub(crate) spell_corrected_queries: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>,
    pub(crate) featured_results_items: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>,
    _request_id: Option<String>,
}
impl QueryOutputBuilder {
    /// <p>The identifier for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">SubmitFeedback</a> API.</p>
    pub fn query_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.query_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">SubmitFeedback</a> API.</p>
    pub fn set_query_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.query_id = input;
        self
    }
    /// <p>The identifier for the search. You also use <code>QueryId</code> to identify the search when using the <a href="https://docs.aws.amazon.com/kendra/latest/APIReference/API_SubmitFeedback.html">SubmitFeedback</a> API.</p>
    pub fn get_query_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.query_id
    }
    /// Appends an item to `result_items`.
    ///
    /// To override the contents of this collection use [`set_result_items`](Self::set_result_items).
    ///
    /// <p>The results of the search.</p>
    pub fn result_items(mut self, input: crate::types::QueryResultItem) -> Self {
        let mut v = self.result_items.unwrap_or_default();
        v.push(input);
        self.result_items = ::std::option::Option::Some(v);
        self
    }
    /// <p>The results of the search.</p>
    pub fn set_result_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>) -> Self {
        self.result_items = input;
        self
    }
    /// <p>The results of the search.</p>
    pub fn get_result_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>> {
        &self.result_items
    }
    /// Appends an item to `facet_results`.
    ///
    /// To override the contents of this collection use [`set_facet_results`](Self::set_facet_results).
    ///
    /// <p>Contains the facet results. A <code>FacetResult</code> contains the counts for each field/attribute key that was specified in the <code>Facets</code> input parameter.</p>
    pub fn facet_results(mut self, input: crate::types::FacetResult) -> Self {
        let mut v = self.facet_results.unwrap_or_default();
        v.push(input);
        self.facet_results = ::std::option::Option::Some(v);
        self
    }
    /// <p>Contains the facet results. A <code>FacetResult</code> contains the counts for each field/attribute key that was specified in the <code>Facets</code> input parameter.</p>
    pub fn set_facet_results(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>) -> Self {
        self.facet_results = input;
        self
    }
    /// <p>Contains the facet results. A <code>FacetResult</code> contains the counts for each field/attribute key that was specified in the <code>Facets</code> input parameter.</p>
    pub fn get_facet_results(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FacetResult>> {
        &self.facet_results
    }
    /// <p>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.</p>
    pub fn total_number_of_results(mut self, input: i32) -> Self {
        self.total_number_of_results = ::std::option::Option::Some(input);
        self
    }
    /// <p>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.</p>
    pub fn set_total_number_of_results(mut self, input: ::std::option::Option<i32>) -> Self {
        self.total_number_of_results = input;
        self
    }
    /// <p>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.</p>
    pub fn get_total_number_of_results(&self) -> &::std::option::Option<i32> {
        &self.total_number_of_results
    }
    /// Appends an item to `warnings`.
    ///
    /// To override the contents of this collection use [`set_warnings`](Self::set_warnings).
    ///
    /// <p>A list of warning codes and their messages on problems with your query.</p>
    /// <p>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 <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a>.</p>
    pub fn warnings(mut self, input: crate::types::Warning) -> Self {
        let mut v = self.warnings.unwrap_or_default();
        v.push(input);
        self.warnings = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of warning codes and their messages on problems with your query.</p>
    /// <p>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 <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a>.</p>
    pub fn set_warnings(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>) -> Self {
        self.warnings = input;
        self
    }
    /// <p>A list of warning codes and their messages on problems with your query.</p>
    /// <p>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 <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a>.</p>
    pub fn get_warnings(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Warning>> {
        &self.warnings
    }
    /// Appends an item to `spell_corrected_queries`.
    ///
    /// To override the contents of this collection use [`set_spell_corrected_queries`](Self::set_spell_corrected_queries).
    ///
    /// <p>A list of information related to suggested spell corrections for a query.</p>
    pub fn spell_corrected_queries(mut self, input: crate::types::SpellCorrectedQuery) -> Self {
        let mut v = self.spell_corrected_queries.unwrap_or_default();
        v.push(input);
        self.spell_corrected_queries = ::std::option::Option::Some(v);
        self
    }
    /// <p>A list of information related to suggested spell corrections for a query.</p>
    pub fn set_spell_corrected_queries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>) -> Self {
        self.spell_corrected_queries = input;
        self
    }
    /// <p>A list of information related to suggested spell corrections for a query.</p>
    pub fn get_spell_corrected_queries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>> {
        &self.spell_corrected_queries
    }
    /// Appends an item to `featured_results_items`.
    ///
    /// To override the contents of this collection use [`set_featured_results_items`](Self::set_featured_results_items).
    ///
    /// <p>The list of featured result items. Featured results are displayed at the top of the search results page, placed above all other results for certain queries. If there's an exact match of a query, then certain documents are featured in the search results.</p>
    pub fn featured_results_items(mut self, input: crate::types::FeaturedResultsItem) -> Self {
        let mut v = self.featured_results_items.unwrap_or_default();
        v.push(input);
        self.featured_results_items = ::std::option::Option::Some(v);
        self
    }
    /// <p>The list of featured result items. Featured results are displayed at the top of the search results page, placed above all other results for certain queries. If there's an exact match of a query, then certain documents are featured in the search results.</p>
    pub fn set_featured_results_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>) -> Self {
        self.featured_results_items = input;
        self
    }
    /// <p>The list of featured result items. Featured results are displayed at the top of the search results page, placed above all other results for certain queries. If there's an exact match of a query, then certain documents are featured in the search results.</p>
    pub fn get_featured_results_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>> {
        &self.featured_results_items
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`QueryOutput`](crate::operation::query::QueryOutput).
    pub fn build(self) -> crate::operation::query::QueryOutput {
        crate::operation::query::QueryOutput {
            query_id: self.query_id,
            result_items: self.result_items,
            facet_results: self.facet_results,
            total_number_of_results: self.total_number_of_results,
            warnings: self.warnings,
            spell_corrected_queries: self.spell_corrected_queries,
            featured_results_items: self.featured_results_items,
            _request_id: self._request_id,
        }
    }
}