aws-sdk-kendra 1.104.0

AWS SDK for AWSKendraFrontendService
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Information about a document attribute or field. You can use document attributes as facets.</p>
/// <p>For example, the document attribute or facet "Department" includes the values "HR", "Engineering", and "Accounting". You can display these values in the search results so that documents can be searched by department.</p>
/// <p>You can display up to 10 facet values per facet for a query. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Facet {
    /// <p>The unique key for the document attribute.</p>
    pub document_attribute_key: ::std::option::Option<::std::string::String>,
    /// <p>An array of document attributes that are nested facets within a facet.</p>
    /// <p>For example, the document attribute or facet "Department" includes a value called "Engineering". In addition, the document attribute or facet "SubDepartment" includes the values "Frontend" and "Backend" for documents assigned to "Engineering". You can display nested facets in the search results so that documents can be searched not only by department but also by a sub department within a department. This helps your users further narrow their search.</p>
    /// <p>You can only have one nested facet within a facet. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub facets: ::std::option::Option<::std::vec::Vec<crate::types::Facet>>,
    /// <p>Maximum number of facet values per facet. The default is 10. You can use this to limit the number of facet values to less than 10. If you want to increase the default, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub max_results: i32,
}
impl Facet {
    /// <p>The unique key for the document attribute.</p>
    pub fn document_attribute_key(&self) -> ::std::option::Option<&str> {
        self.document_attribute_key.as_deref()
    }
    /// <p>An array of document attributes that are nested facets within a facet.</p>
    /// <p>For example, the document attribute or facet "Department" includes a value called "Engineering". In addition, the document attribute or facet "SubDepartment" includes the values "Frontend" and "Backend" for documents assigned to "Engineering". You can display nested facets in the search results so that documents can be searched not only by department but also by a sub department within a department. This helps your users further narrow their search.</p>
    /// <p>You can only have one nested facet within a facet. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</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 `.facets.is_none()`.
    pub fn facets(&self) -> &[crate::types::Facet] {
        self.facets.as_deref().unwrap_or_default()
    }
    /// <p>Maximum number of facet values per facet. The default is 10. You can use this to limit the number of facet values to less than 10. If you want to increase the default, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn max_results(&self) -> i32 {
        self.max_results
    }
}
impl Facet {
    /// Creates a new builder-style object to manufacture [`Facet`](crate::types::Facet).
    pub fn builder() -> crate::types::builders::FacetBuilder {
        crate::types::builders::FacetBuilder::default()
    }
}

/// A builder for [`Facet`](crate::types::Facet).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct FacetBuilder {
    pub(crate) document_attribute_key: ::std::option::Option<::std::string::String>,
    pub(crate) facets: ::std::option::Option<::std::vec::Vec<crate::types::Facet>>,
    pub(crate) max_results: ::std::option::Option<i32>,
}
impl FacetBuilder {
    /// <p>The unique key for the document attribute.</p>
    pub fn document_attribute_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.document_attribute_key = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>The unique key for the document attribute.</p>
    pub fn set_document_attribute_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.document_attribute_key = input;
        self
    }
    /// <p>The unique key for the document attribute.</p>
    pub fn get_document_attribute_key(&self) -> &::std::option::Option<::std::string::String> {
        &self.document_attribute_key
    }
    /// Appends an item to `facets`.
    ///
    /// To override the contents of this collection use [`set_facets`](Self::set_facets).
    ///
    /// <p>An array of document attributes that are nested facets within a facet.</p>
    /// <p>For example, the document attribute or facet "Department" includes a value called "Engineering". In addition, the document attribute or facet "SubDepartment" includes the values "Frontend" and "Backend" for documents assigned to "Engineering". You can display nested facets in the search results so that documents can be searched not only by department but also by a sub department within a department. This helps your users further narrow their search.</p>
    /// <p>You can only have one nested facet within a facet. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn facets(mut self, input: crate::types::Facet) -> Self {
        let mut v = self.facets.unwrap_or_default();
        v.push(input);
        self.facets = ::std::option::Option::Some(v);
        self
    }
    /// <p>An array of document attributes that are nested facets within a facet.</p>
    /// <p>For example, the document attribute or facet "Department" includes a value called "Engineering". In addition, the document attribute or facet "SubDepartment" includes the values "Frontend" and "Backend" for documents assigned to "Engineering". You can display nested facets in the search results so that documents can be searched not only by department but also by a sub department within a department. This helps your users further narrow their search.</p>
    /// <p>You can only have one nested facet within a facet. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn set_facets(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Facet>>) -> Self {
        self.facets = input;
        self
    }
    /// <p>An array of document attributes that are nested facets within a facet.</p>
    /// <p>For example, the document attribute or facet "Department" includes a value called "Engineering". In addition, the document attribute or facet "SubDepartment" includes the values "Frontend" and "Backend" for documents assigned to "Engineering". You can display nested facets in the search results so that documents can be searched not only by department but also by a sub department within a department. This helps your users further narrow their search.</p>
    /// <p>You can only have one nested facet within a facet. If you want to increase this limit, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn get_facets(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Facet>> {
        &self.facets
    }
    /// <p>Maximum number of facet values per facet. The default is 10. You can use this to limit the number of facet values to less than 10. If you want to increase the default, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn max_results(mut self, input: i32) -> Self {
        self.max_results = ::std::option::Option::Some(input);
        self
    }
    /// <p>Maximum number of facet values per facet. The default is 10. You can use this to limit the number of facet values to less than 10. If you want to increase the default, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn set_max_results(mut self, input: ::std::option::Option<i32>) -> Self {
        self.max_results = input;
        self
    }
    /// <p>Maximum number of facet values per facet. The default is 10. You can use this to limit the number of facet values to less than 10. If you want to increase the default, contact <a href="http://aws.amazon.com/contact-us/">Support</a>.</p>
    pub fn get_max_results(&self) -> &::std::option::Option<i32> {
        &self.max_results
    }
    /// Consumes the builder and constructs a [`Facet`](crate::types::Facet).
    pub fn build(self) -> crate::types::Facet {
        crate::types::Facet {
            document_attribute_key: self.document_attribute_key,
            facets: self.facets,
            max_results: self.max_results.unwrap_or_default(),
        }
    }
}