aws-sdk-kendra 1.104.0

AWS SDK for AWSKendraFrontendService
Documentation
// 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 GetQuerySuggestionsInput {
    /// <p>The identifier of the index you want to get query suggestions from.</p>
    pub index_id: ::std::option::Option<::std::string::String>,
    /// <p>The text of a user's query to generate query suggestions.</p>
    /// <p>A query is suggested if the query prefix matches what a user starts to type as their query.</p>
    /// <p>Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.</p>
    pub query_text: ::std::option::Option<::std::string::String>,
    /// <p>The maximum number of query suggestions you want to show to your users.</p>
    pub max_suggestions_count: ::std::option::Option<i32>,
    /// <p>The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.</p>
    /// <p>If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.</p>
    /// <p>If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.</p>
    pub suggestion_types: ::std::option::Option<::std::vec::Vec<crate::types::SuggestionType>>,
    /// <p>Configuration information for the document fields/attributes that you want to base query suggestions on.</p>
    pub attribute_suggestions_config: ::std::option::Option<crate::types::AttributeSuggestionsGetConfig>,
}
impl GetQuerySuggestionsInput {
    /// <p>The identifier of the index you want to get query suggestions from.</p>
    pub fn index_id(&self) -> ::std::option::Option<&str> {
        self.index_id.as_deref()
    }
    /// <p>The text of a user's query to generate query suggestions.</p>
    /// <p>A query is suggested if the query prefix matches what a user starts to type as their query.</p>
    /// <p>Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.</p>
    pub fn query_text(&self) -> ::std::option::Option<&str> {
        self.query_text.as_deref()
    }
    /// <p>The maximum number of query suggestions you want to show to your users.</p>
    pub fn max_suggestions_count(&self) -> ::std::option::Option<i32> {
        self.max_suggestions_count
    }
    /// <p>The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.</p>
    /// <p>If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.</p>
    /// <p>If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.</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 `.suggestion_types.is_none()`.
    pub fn suggestion_types(&self) -> &[crate::types::SuggestionType] {
        self.suggestion_types.as_deref().unwrap_or_default()
    }
    /// <p>Configuration information for the document fields/attributes that you want to base query suggestions on.</p>
    pub fn attribute_suggestions_config(&self) -> ::std::option::Option<&crate::types::AttributeSuggestionsGetConfig> {
        self.attribute_suggestions_config.as_ref()
    }
}
impl GetQuerySuggestionsInput {
    /// Creates a new builder-style object to manufacture [`GetQuerySuggestionsInput`](crate::operation::get_query_suggestions::GetQuerySuggestionsInput).
    pub fn builder() -> crate::operation::get_query_suggestions::builders::GetQuerySuggestionsInputBuilder {
        crate::operation::get_query_suggestions::builders::GetQuerySuggestionsInputBuilder::default()
    }
}

/// A builder for [`GetQuerySuggestionsInput`](crate::operation::get_query_suggestions::GetQuerySuggestionsInput).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct GetQuerySuggestionsInputBuilder {
    pub(crate) index_id: ::std::option::Option<::std::string::String>,
    pub(crate) query_text: ::std::option::Option<::std::string::String>,
    pub(crate) max_suggestions_count: ::std::option::Option<i32>,
    pub(crate) suggestion_types: ::std::option::Option<::std::vec::Vec<crate::types::SuggestionType>>,
    pub(crate) attribute_suggestions_config: ::std::option::Option<crate::types::AttributeSuggestionsGetConfig>,
}
impl GetQuerySuggestionsInputBuilder {
    /// <p>The identifier of the index you want to get query suggestions from.</p>
    /// This field is required.
    pub fn index_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.index_id = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The identifier of the index you want to get query suggestions from.</p>
    pub fn set_index_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.index_id = input;
        self
    }
    /// <p>The identifier of the index you want to get query suggestions from.</p>
    pub fn get_index_id(&self) -> &::std::option::Option<::std::string::String> {
        &self.index_id
    }
    /// <p>The text of a user's query to generate query suggestions.</p>
    /// <p>A query is suggested if the query prefix matches what a user starts to type as their query.</p>
    /// <p>Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.</p>
    /// This field is required.
    pub fn query_text(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.query_text = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The text of a user's query to generate query suggestions.</p>
    /// <p>A query is suggested if the query prefix matches what a user starts to type as their query.</p>
    /// <p>Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.</p>
    pub fn set_query_text(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.query_text = input;
        self
    }
    /// <p>The text of a user's query to generate query suggestions.</p>
    /// <p>A query is suggested if the query prefix matches what a user starts to type as their query.</p>
    /// <p>Amazon Kendra does not show any suggestions if a user types fewer than two characters or more than 60 characters. A query must also have at least one search result and contain at least one word of more than four characters.</p>
    pub fn get_query_text(&self) -> &::std::option::Option<::std::string::String> {
        &self.query_text
    }
    /// <p>The maximum number of query suggestions you want to show to your users.</p>
    pub fn max_suggestions_count(mut self, input: i32) -> Self {
        self.max_suggestions_count = ::std::option::Option::Some(input);
        self
    }
    /// <p>The maximum number of query suggestions you want to show to your users.</p>
    pub fn set_max_suggestions_count(mut self, input: ::std::option::Option<i32>) -> Self {
        self.max_suggestions_count = input;
        self
    }
    /// <p>The maximum number of query suggestions you want to show to your users.</p>
    pub fn get_max_suggestions_count(&self) -> &::std::option::Option<i32> {
        &self.max_suggestions_count
    }
    /// Appends an item to `suggestion_types`.
    ///
    /// To override the contents of this collection use [`set_suggestion_types`](Self::set_suggestion_types).
    ///
    /// <p>The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.</p>
    /// <p>If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.</p>
    /// <p>If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.</p>
    pub fn suggestion_types(mut self, input: crate::types::SuggestionType) -> Self {
        let mut v = self.suggestion_types.unwrap_or_default();
        v.push(input);
        self.suggestion_types = ::std::option::Option::Some(v);
        self
    }
    /// <p>The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.</p>
    /// <p>If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.</p>
    /// <p>If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.</p>
    pub fn set_suggestion_types(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::SuggestionType>>) -> Self {
        self.suggestion_types = input;
        self
    }
    /// <p>The suggestions type to base query suggestions on. The suggestion types are query history or document fields/attributes. You can set one type or the other.</p>
    /// <p>If you set query history as your suggestions type, Amazon Kendra suggests queries relevant to your users based on popular queries in the query history.</p>
    /// <p>If you set document fields/attributes as your suggestions type, Amazon Kendra suggests queries relevant to your users based on the contents of document fields.</p>
    pub fn get_suggestion_types(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::SuggestionType>> {
        &self.suggestion_types
    }
    /// <p>Configuration information for the document fields/attributes that you want to base query suggestions on.</p>
    pub fn attribute_suggestions_config(mut self, input: crate::types::AttributeSuggestionsGetConfig) -> Self {
        self.attribute_suggestions_config = ::std::option::Option::Some(input);
        self
    }
    /// <p>Configuration information for the document fields/attributes that you want to base query suggestions on.</p>
    pub fn set_attribute_suggestions_config(mut self, input: ::std::option::Option<crate::types::AttributeSuggestionsGetConfig>) -> Self {
        self.attribute_suggestions_config = input;
        self
    }
    /// <p>Configuration information for the document fields/attributes that you want to base query suggestions on.</p>
    pub fn get_attribute_suggestions_config(&self) -> &::std::option::Option<crate::types::AttributeSuggestionsGetConfig> {
        &self.attribute_suggestions_config
    }
    /// Consumes the builder and constructs a [`GetQuerySuggestionsInput`](crate::operation::get_query_suggestions::GetQuerySuggestionsInput).
    pub fn build(
        self,
    ) -> ::std::result::Result<crate::operation::get_query_suggestions::GetQuerySuggestionsInput, ::aws_smithy_types::error::operation::BuildError>
    {
        ::std::result::Result::Ok(crate::operation::get_query_suggestions::GetQuerySuggestionsInput {
            index_id: self.index_id,
            query_text: self.query_text,
            max_suggestions_count: self.max_suggestions_count,
            suggestion_types: self.suggestion_types,
            attribute_suggestions_config: self.attribute_suggestions_config,
        })
    }
}