aws_sdk_kendra/operation/retrieve/_retrieve_input.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 RetrieveInput {
6 /// <p>The identifier of the index to retrieve relevant passages for the search.</p>
7 pub index_id: ::std::option::Option<::std::string::String>,
8 /// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
9 pub query_text: ::std::option::Option<::std::string::String>,
10 /// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
11 /// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
12 /// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
13 /// </note>
14 pub attribute_filter: ::std::option::Option<crate::types::AttributeFilter>,
15 /// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
16 pub requested_document_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
17 /// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
18 /// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
19 /// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
20 pub document_relevance_override_configurations: ::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>>,
21 /// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
22 pub page_number: ::std::option::Option<i32>,
23 /// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
24 pub page_size: ::std::option::Option<i32>,
25 /// <p>The user context token or user and group information.</p>
26 pub user_context: ::std::option::Option<crate::types::UserContext>,
27}
28impl RetrieveInput {
29 /// <p>The identifier of the index to retrieve relevant passages for the search.</p>
30 pub fn index_id(&self) -> ::std::option::Option<&str> {
31 self.index_id.as_deref()
32 }
33 /// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
34 pub fn query_text(&self) -> ::std::option::Option<&str> {
35 self.query_text.as_deref()
36 }
37 /// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
38 /// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
39 /// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
40 /// </note>
41 pub fn attribute_filter(&self) -> ::std::option::Option<&crate::types::AttributeFilter> {
42 self.attribute_filter.as_ref()
43 }
44 /// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
45 ///
46 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.requested_document_attributes.is_none()`.
47 pub fn requested_document_attributes(&self) -> &[::std::string::String] {
48 self.requested_document_attributes.as_deref().unwrap_or_default()
49 }
50 /// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
51 /// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
52 /// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
53 ///
54 /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.document_relevance_override_configurations.is_none()`.
55 pub fn document_relevance_override_configurations(&self) -> &[crate::types::DocumentRelevanceConfiguration] {
56 self.document_relevance_override_configurations.as_deref().unwrap_or_default()
57 }
58 /// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
59 pub fn page_number(&self) -> ::std::option::Option<i32> {
60 self.page_number
61 }
62 /// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
63 pub fn page_size(&self) -> ::std::option::Option<i32> {
64 self.page_size
65 }
66 /// <p>The user context token or user and group information.</p>
67 pub fn user_context(&self) -> ::std::option::Option<&crate::types::UserContext> {
68 self.user_context.as_ref()
69 }
70}
71impl RetrieveInput {
72 /// Creates a new builder-style object to manufacture [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
73 pub fn builder() -> crate::operation::retrieve::builders::RetrieveInputBuilder {
74 crate::operation::retrieve::builders::RetrieveInputBuilder::default()
75 }
76}
77
78/// A builder for [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
79#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
80#[non_exhaustive]
81pub struct RetrieveInputBuilder {
82 pub(crate) index_id: ::std::option::Option<::std::string::String>,
83 pub(crate) query_text: ::std::option::Option<::std::string::String>,
84 pub(crate) attribute_filter: ::std::option::Option<crate::types::AttributeFilter>,
85 pub(crate) requested_document_attributes: ::std::option::Option<::std::vec::Vec<::std::string::String>>,
86 pub(crate) document_relevance_override_configurations: ::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>>,
87 pub(crate) page_number: ::std::option::Option<i32>,
88 pub(crate) page_size: ::std::option::Option<i32>,
89 pub(crate) user_context: ::std::option::Option<crate::types::UserContext>,
90}
91impl RetrieveInputBuilder {
92 /// <p>The identifier of the index to retrieve relevant passages for the search.</p>
93 /// This field is required.
94 pub fn index_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
95 self.index_id = ::std::option::Option::Some(input.into());
96 self
97 }
98 /// <p>The identifier of the index to retrieve relevant passages for the search.</p>
99 pub fn set_index_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
100 self.index_id = input;
101 self
102 }
103 /// <p>The identifier of the index to retrieve relevant passages for the search.</p>
104 pub fn get_index_id(&self) -> &::std::option::Option<::std::string::String> {
105 &self.index_id
106 }
107 /// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
108 /// This field is required.
109 pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
110 self.query_text = ::std::option::Option::Some(input.into());
111 self
112 }
113 /// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
114 pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
115 self.query_text = input;
116 self
117 }
118 /// <p>The input query text to retrieve relevant passages for the search. Amazon Kendra truncates queries at 30 token words, which excludes punctuation and stop words. Truncation still applies if you use Boolean or more advanced, complex queries. For example, <code>Timeoff AND October AND Category:HR</code> is counted as 3 tokens: <code>timeoff</code>, <code>october</code>, <code>hr</code>. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/searching-example.html#searching-index-query-syntax">Searching with advanced query syntax</a> in the Amazon Kendra Developer Guide.</p>
119 pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
120 &self.query_text
121 }
122 /// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
123 /// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
124 /// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
125 /// </note>
126 pub fn attribute_filter(mut self, input: crate::types::AttributeFilter) -> Self {
127 self.attribute_filter = ::std::option::Option::Some(input);
128 self
129 }
130 /// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
131 /// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
132 /// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
133 /// </note>
134 pub fn set_attribute_filter(mut self, input: ::std::option::Option<crate::types::AttributeFilter>) -> Self {
135 self.attribute_filter = input;
136 self
137 }
138 /// <p>Filters search results by document fields/attributes. You can only provide one attribute filter; however, the <code>AndAllFilters</code>, <code>NotFilter</code>, and <code>OrAllFilters</code> parameters contain a list of other filters.</p>
139 /// <p>The <code>AttributeFilter</code> parameter means you can create a set of filtering rules that a document must satisfy to be included in the query results.</p><note>
140 /// <p>For Amazon Kendra Gen AI Enterprise Edition indices use <code>AttributeFilter</code> to enable document filtering for end users using <code>_email_id</code> or include public documents (<code>_email_id=null</code>).</p>
141 /// </note>
142 pub fn get_attribute_filter(&self) -> &::std::option::Option<crate::types::AttributeFilter> {
143 &self.attribute_filter
144 }
145 /// Appends an item to `requested_document_attributes`.
146 ///
147 /// To override the contents of this collection use [`set_requested_document_attributes`](Self::set_requested_document_attributes).
148 ///
149 /// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
150 pub fn requested_document_attributes(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
151 let mut v = self.requested_document_attributes.unwrap_or_default();
152 v.push(input.into());
153 self.requested_document_attributes = ::std::option::Option::Some(v);
154 self
155 }
156 /// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
157 pub fn set_requested_document_attributes(mut self, input: ::std::option::Option<::std::vec::Vec<::std::string::String>>) -> Self {
158 self.requested_document_attributes = input;
159 self
160 }
161 /// <p>A list of document fields/attributes to include in the response. You can limit the response to include certain document fields. By default, all document fields are included in the response.</p>
162 pub fn get_requested_document_attributes(&self) -> &::std::option::Option<::std::vec::Vec<::std::string::String>> {
163 &self.requested_document_attributes
164 }
165 /// Appends an item to `document_relevance_override_configurations`.
166 ///
167 /// To override the contents of this collection use [`set_document_relevance_override_configurations`](Self::set_document_relevance_override_configurations).
168 ///
169 /// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
170 /// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
171 /// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
172 pub fn document_relevance_override_configurations(mut self, input: crate::types::DocumentRelevanceConfiguration) -> Self {
173 let mut v = self.document_relevance_override_configurations.unwrap_or_default();
174 v.push(input);
175 self.document_relevance_override_configurations = ::std::option::Option::Some(v);
176 self
177 }
178 /// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
179 /// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
180 /// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
181 pub fn set_document_relevance_override_configurations(
182 mut self,
183 input: ::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>>,
184 ) -> Self {
185 self.document_relevance_override_configurations = input;
186 self
187 }
188 /// <p>Overrides relevance tuning configurations of fields/attributes set at the index level.</p>
189 /// <p>If you use this API to override the relevance tuning configured at the index level, but there is no relevance tuning configured at the index level, then Amazon Kendra does not apply any relevance tuning.</p>
190 /// <p>If there is relevance tuning configured for fields at the index level, and you use this API to override only some of these fields, then for the fields you did not override, the importance is set to 1.</p>
191 pub fn get_document_relevance_override_configurations(
192 &self,
193 ) -> &::std::option::Option<::std::vec::Vec<crate::types::DocumentRelevanceConfiguration>> {
194 &self.document_relevance_override_configurations
195 }
196 /// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
197 pub fn page_number(mut self, input: i32) -> Self {
198 self.page_number = ::std::option::Option::Some(input);
199 self
200 }
201 /// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
202 pub fn set_page_number(mut self, input: ::std::option::Option<i32>) -> Self {
203 self.page_number = input;
204 self
205 }
206 /// <p>Retrieved relevant passages are returned in pages the size of the <code>PageSize</code> parameter. By default, Amazon Kendra returns the first page of results. Use this parameter to get result pages after the first one.</p>
207 pub fn get_page_number(&self) -> &::std::option::Option<i32> {
208 &self.page_number
209 }
210 /// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
211 pub fn page_size(mut self, input: i32) -> Self {
212 self.page_size = ::std::option::Option::Some(input);
213 self
214 }
215 /// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
216 pub fn set_page_size(mut self, input: ::std::option::Option<i32>) -> Self {
217 self.page_size = input;
218 self
219 }
220 /// <p>Sets the number of retrieved relevant passages that are returned in each page of results. The default page size is 10. The maximum number of results returned is 100. If you ask for more than 100 results, only 100 are returned.</p>
221 pub fn get_page_size(&self) -> &::std::option::Option<i32> {
222 &self.page_size
223 }
224 /// <p>The user context token or user and group information.</p>
225 pub fn user_context(mut self, input: crate::types::UserContext) -> Self {
226 self.user_context = ::std::option::Option::Some(input);
227 self
228 }
229 /// <p>The user context token or user and group information.</p>
230 pub fn set_user_context(mut self, input: ::std::option::Option<crate::types::UserContext>) -> Self {
231 self.user_context = input;
232 self
233 }
234 /// <p>The user context token or user and group information.</p>
235 pub fn get_user_context(&self) -> &::std::option::Option<crate::types::UserContext> {
236 &self.user_context
237 }
238 /// Consumes the builder and constructs a [`RetrieveInput`](crate::operation::retrieve::RetrieveInput).
239 pub fn build(self) -> ::std::result::Result<crate::operation::retrieve::RetrieveInput, ::aws_smithy_types::error::operation::BuildError> {
240 ::std::result::Result::Ok(crate::operation::retrieve::RetrieveInput {
241 index_id: self.index_id,
242 query_text: self.query_text,
243 attribute_filter: self.attribute_filter,
244 requested_document_attributes: self.requested_document_attributes,
245 document_relevance_override_configurations: self.document_relevance_override_configurations,
246 page_number: self.page_number,
247 page_size: self.page_size,
248 user_context: self.user_context,
249 })
250 }
251}