aws_sdk_kendra/operation/query/
_query_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2#[allow(missing_docs)] // documentation missing in model
3#[non_exhaustive]
4#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
5pub struct QueryOutput {
6    /// <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>
7    pub query_id: ::std::option::Option<::std::string::String>,
8    /// <p>The results of the search.</p>
9    pub result_items: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>,
10    /// <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>
11    pub facet_results: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>,
12    /// <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>
13    pub total_number_of_results: ::std::option::Option<i32>,
14    /// <p>A list of warning codes and their messages on problems with your query.</p>
15    /// <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>
16    pub warnings: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>,
17    /// <p>A list of information related to suggested spell corrections for a query.</p>
18    pub spell_corrected_queries: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>,
19    /// <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>
20    pub featured_results_items: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>,
21    _request_id: Option<String>,
22}
23impl QueryOutput {
24    /// <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>
25    pub fn query_id(&self) -> ::std::option::Option<&str> {
26        self.query_id.as_deref()
27    }
28    /// <p>The results of the search.</p>
29    ///
30    /// 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()`.
31    pub fn result_items(&self) -> &[crate::types::QueryResultItem] {
32        self.result_items.as_deref().unwrap_or_default()
33    }
34    /// <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>
35    ///
36    /// 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()`.
37    pub fn facet_results(&self) -> &[crate::types::FacetResult] {
38        self.facet_results.as_deref().unwrap_or_default()
39    }
40    /// <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>
41    pub fn total_number_of_results(&self) -> ::std::option::Option<i32> {
42        self.total_number_of_results
43    }
44    /// <p>A list of warning codes and their messages on problems with your query.</p>
45    /// <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>
46    ///
47    /// 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()`.
48    pub fn warnings(&self) -> &[crate::types::Warning] {
49        self.warnings.as_deref().unwrap_or_default()
50    }
51    /// <p>A list of information related to suggested spell corrections for a query.</p>
52    ///
53    /// 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()`.
54    pub fn spell_corrected_queries(&self) -> &[crate::types::SpellCorrectedQuery] {
55        self.spell_corrected_queries.as_deref().unwrap_or_default()
56    }
57    /// <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>
58    ///
59    /// 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()`.
60    pub fn featured_results_items(&self) -> &[crate::types::FeaturedResultsItem] {
61        self.featured_results_items.as_deref().unwrap_or_default()
62    }
63}
64impl ::aws_types::request_id::RequestId for QueryOutput {
65    fn request_id(&self) -> Option<&str> {
66        self._request_id.as_deref()
67    }
68}
69impl QueryOutput {
70    /// Creates a new builder-style object to manufacture [`QueryOutput`](crate::operation::query::QueryOutput).
71    pub fn builder() -> crate::operation::query::builders::QueryOutputBuilder {
72        crate::operation::query::builders::QueryOutputBuilder::default()
73    }
74}
75
76/// A builder for [`QueryOutput`](crate::operation::query::QueryOutput).
77#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
78#[non_exhaustive]
79pub struct QueryOutputBuilder {
80    pub(crate) query_id: ::std::option::Option<::std::string::String>,
81    pub(crate) result_items: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>,
82    pub(crate) facet_results: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>,
83    pub(crate) total_number_of_results: ::std::option::Option<i32>,
84    pub(crate) warnings: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>,
85    pub(crate) spell_corrected_queries: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>,
86    pub(crate) featured_results_items: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>,
87    _request_id: Option<String>,
88}
89impl QueryOutputBuilder {
90    /// <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>
91    pub fn query_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
92        self.query_id = ::std::option::Option::Some(input.into());
93        self
94    }
95    /// <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>
96    pub fn set_query_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
97        self.query_id = input;
98        self
99    }
100    /// <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>
101    pub fn get_query_id(&self) -> &::std::option::Option<::std::string::String> {
102        &self.query_id
103    }
104    /// Appends an item to `result_items`.
105    ///
106    /// To override the contents of this collection use [`set_result_items`](Self::set_result_items).
107    ///
108    /// <p>The results of the search.</p>
109    pub fn result_items(mut self, input: crate::types::QueryResultItem) -> Self {
110        let mut v = self.result_items.unwrap_or_default();
111        v.push(input);
112        self.result_items = ::std::option::Option::Some(v);
113        self
114    }
115    /// <p>The results of the search.</p>
116    pub fn set_result_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>>) -> Self {
117        self.result_items = input;
118        self
119    }
120    /// <p>The results of the search.</p>
121    pub fn get_result_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::QueryResultItem>> {
122        &self.result_items
123    }
124    /// Appends an item to `facet_results`.
125    ///
126    /// To override the contents of this collection use [`set_facet_results`](Self::set_facet_results).
127    ///
128    /// <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>
129    pub fn facet_results(mut self, input: crate::types::FacetResult) -> Self {
130        let mut v = self.facet_results.unwrap_or_default();
131        v.push(input);
132        self.facet_results = ::std::option::Option::Some(v);
133        self
134    }
135    /// <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>
136    pub fn set_facet_results(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FacetResult>>) -> Self {
137        self.facet_results = input;
138        self
139    }
140    /// <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>
141    pub fn get_facet_results(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FacetResult>> {
142        &self.facet_results
143    }
144    /// <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>
145    pub fn total_number_of_results(mut self, input: i32) -> Self {
146        self.total_number_of_results = ::std::option::Option::Some(input);
147        self
148    }
149    /// <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>
150    pub fn set_total_number_of_results(mut self, input: ::std::option::Option<i32>) -> Self {
151        self.total_number_of_results = input;
152        self
153    }
154    /// <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>
155    pub fn get_total_number_of_results(&self) -> &::std::option::Option<i32> {
156        &self.total_number_of_results
157    }
158    /// Appends an item to `warnings`.
159    ///
160    /// To override the contents of this collection use [`set_warnings`](Self::set_warnings).
161    ///
162    /// <p>A list of warning codes and their messages on problems with your query.</p>
163    /// <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>
164    pub fn warnings(mut self, input: crate::types::Warning) -> Self {
165        let mut v = self.warnings.unwrap_or_default();
166        v.push(input);
167        self.warnings = ::std::option::Option::Some(v);
168        self
169    }
170    /// <p>A list of warning codes and their messages on problems with your query.</p>
171    /// <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>
172    pub fn set_warnings(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Warning>>) -> Self {
173        self.warnings = input;
174        self
175    }
176    /// <p>A list of warning codes and their messages on problems with your query.</p>
177    /// <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>
178    pub fn get_warnings(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Warning>> {
179        &self.warnings
180    }
181    /// Appends an item to `spell_corrected_queries`.
182    ///
183    /// To override the contents of this collection use [`set_spell_corrected_queries`](Self::set_spell_corrected_queries).
184    ///
185    /// <p>A list of information related to suggested spell corrections for a query.</p>
186    pub fn spell_corrected_queries(mut self, input: crate::types::SpellCorrectedQuery) -> Self {
187        let mut v = self.spell_corrected_queries.unwrap_or_default();
188        v.push(input);
189        self.spell_corrected_queries = ::std::option::Option::Some(v);
190        self
191    }
192    /// <p>A list of information related to suggested spell corrections for a query.</p>
193    pub fn set_spell_corrected_queries(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>>) -> Self {
194        self.spell_corrected_queries = input;
195        self
196    }
197    /// <p>A list of information related to suggested spell corrections for a query.</p>
198    pub fn get_spell_corrected_queries(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SpellCorrectedQuery>> {
199        &self.spell_corrected_queries
200    }
201    /// Appends an item to `featured_results_items`.
202    ///
203    /// To override the contents of this collection use [`set_featured_results_items`](Self::set_featured_results_items).
204    ///
205    /// <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>
206    pub fn featured_results_items(mut self, input: crate::types::FeaturedResultsItem) -> Self {
207        let mut v = self.featured_results_items.unwrap_or_default();
208        v.push(input);
209        self.featured_results_items = ::std::option::Option::Some(v);
210        self
211    }
212    /// <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>
213    pub fn set_featured_results_items(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>>) -> Self {
214        self.featured_results_items = input;
215        self
216    }
217    /// <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>
218    pub fn get_featured_results_items(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::FeaturedResultsItem>> {
219        &self.featured_results_items
220    }
221    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
222        self._request_id = Some(request_id.into());
223        self
224    }
225
226    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
227        self._request_id = request_id;
228        self
229    }
230    /// Consumes the builder and constructs a [`QueryOutput`](crate::operation::query::QueryOutput).
231    pub fn build(self) -> crate::operation::query::QueryOutput {
232        crate::operation::query::QueryOutput {
233            query_id: self.query_id,
234            result_items: self.result_items,
235            facet_results: self.facet_results,
236            total_number_of_results: self.total_number_of_results,
237            warnings: self.warnings,
238            spell_corrected_queries: self.spell_corrected_queries,
239            featured_results_items: self.featured_results_items,
240            _request_id: self._request_id,
241        }
242    }
243}