aws-sdk-kendra 1.95.0

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

/// <p>Provides information for tuning the relevance of a field in a search. When a query includes terms that match the field, the results are given a boost in the response based on these tuning parameters.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Relevance {
    /// <p>Indicates that this field determines how "fresh" a document is. For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to <code>DATE</code> fields.</p>
    pub freshness: ::std::option::Option<bool>,
    /// <p>The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers.</p>
    pub importance: ::std::option::Option<i32>,
    /// <p>Specifies the time period that the boost applies to. For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.</p>
    /// <p>Only applies to <code>DATE</code> fields.</p>
    pub duration: ::std::option::Option<::std::string::String>,
    /// <p>Determines how values should be interpreted.</p>
    /// <p>When the <code>RankOrder</code> field is <code>ASCENDING</code>, higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.</p>
    /// <p>When the <code>RankOrder</code> field is <code>DESCENDING</code>, lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.</p>
    /// <p>Only applies to <code>LONG</code> fields.</p>
    pub rank_order: ::std::option::Option<crate::types::Order>,
    /// <p>A list of values that should be given a different boost when they appear in the result list. For example, if you are boosting a field called "department", query terms that match the department field are boosted in the result. However, you can add entries from the department field to boost documents with those values higher.</p>
    /// <p>For example, you can add entries to the map with names of departments. If you add "HR",5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document. When those terms appear they are given the specified importance instead of the regular importance for the boost.</p>
    pub value_importance_map: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
}
impl Relevance {
    /// <p>Indicates that this field determines how "fresh" a document is. For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to <code>DATE</code> fields.</p>
    pub fn freshness(&self) -> ::std::option::Option<bool> {
        self.freshness
    }
    /// <p>The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers.</p>
    pub fn importance(&self) -> ::std::option::Option<i32> {
        self.importance
    }
    /// <p>Specifies the time period that the boost applies to. For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.</p>
    /// <p>Only applies to <code>DATE</code> fields.</p>
    pub fn duration(&self) -> ::std::option::Option<&str> {
        self.duration.as_deref()
    }
    /// <p>Determines how values should be interpreted.</p>
    /// <p>When the <code>RankOrder</code> field is <code>ASCENDING</code>, higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.</p>
    /// <p>When the <code>RankOrder</code> field is <code>DESCENDING</code>, lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.</p>
    /// <p>Only applies to <code>LONG</code> fields.</p>
    pub fn rank_order(&self) -> ::std::option::Option<&crate::types::Order> {
        self.rank_order.as_ref()
    }
    /// <p>A list of values that should be given a different boost when they appear in the result list. For example, if you are boosting a field called "department", query terms that match the department field are boosted in the result. However, you can add entries from the department field to boost documents with those values higher.</p>
    /// <p>For example, you can add entries to the map with names of departments. If you add "HR",5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document. When those terms appear they are given the specified importance instead of the regular importance for the boost.</p>
    pub fn value_importance_map(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, i32>> {
        self.value_importance_map.as_ref()
    }
}
impl Relevance {
    /// Creates a new builder-style object to manufacture [`Relevance`](crate::types::Relevance).
    pub fn builder() -> crate::types::builders::RelevanceBuilder {
        crate::types::builders::RelevanceBuilder::default()
    }
}

/// A builder for [`Relevance`](crate::types::Relevance).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct RelevanceBuilder {
    pub(crate) freshness: ::std::option::Option<bool>,
    pub(crate) importance: ::std::option::Option<i32>,
    pub(crate) duration: ::std::option::Option<::std::string::String>,
    pub(crate) rank_order: ::std::option::Option<crate::types::Order>,
    pub(crate) value_importance_map: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>,
}
impl RelevanceBuilder {
    /// <p>Indicates that this field determines how "fresh" a document is. For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to <code>DATE</code> fields.</p>
    pub fn freshness(mut self, input: bool) -> Self {
        self.freshness = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates that this field determines how "fresh" a document is. For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to <code>DATE</code> fields.</p>
    pub fn set_freshness(mut self, input: ::std::option::Option<bool>) -> Self {
        self.freshness = input;
        self
    }
    /// <p>Indicates that this field determines how "fresh" a document is. For example, if document 1 was created on November 5, and document 2 was created on October 31, document 1 is "fresher" than document 2. Only applies to <code>DATE</code> fields.</p>
    pub fn get_freshness(&self) -> &::std::option::Option<bool> {
        &self.freshness
    }
    /// <p>The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers.</p>
    pub fn importance(mut self, input: i32) -> Self {
        self.importance = ::std::option::Option::Some(input);
        self
    }
    /// <p>The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers.</p>
    pub fn set_importance(mut self, input: ::std::option::Option<i32>) -> Self {
        self.importance = input;
        self
    }
    /// <p>The relative importance of the field in the search. Larger numbers provide more of a boost than smaller numbers.</p>
    pub fn get_importance(&self) -> &::std::option::Option<i32> {
        &self.importance
    }
    /// <p>Specifies the time period that the boost applies to. For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.</p>
    /// <p>Only applies to <code>DATE</code> fields.</p>
    pub fn duration(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.duration = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Specifies the time period that the boost applies to. For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.</p>
    /// <p>Only applies to <code>DATE</code> fields.</p>
    pub fn set_duration(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.duration = input;
        self
    }
    /// <p>Specifies the time period that the boost applies to. For example, to make the boost apply to documents with the field value within the last month, you would use "2628000s". Once the field value is beyond the specified range, the effect of the boost drops off. The higher the importance, the faster the effect drops off. If you don't specify a value, the default is 3 months. The value of the field is a numeric string followed by the character "s", for example "86400s" for one day, or "604800s" for one week.</p>
    /// <p>Only applies to <code>DATE</code> fields.</p>
    pub fn get_duration(&self) -> &::std::option::Option<::std::string::String> {
        &self.duration
    }
    /// <p>Determines how values should be interpreted.</p>
    /// <p>When the <code>RankOrder</code> field is <code>ASCENDING</code>, higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.</p>
    /// <p>When the <code>RankOrder</code> field is <code>DESCENDING</code>, lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.</p>
    /// <p>Only applies to <code>LONG</code> fields.</p>
    pub fn rank_order(mut self, input: crate::types::Order) -> Self {
        self.rank_order = ::std::option::Option::Some(input);
        self
    }
    /// <p>Determines how values should be interpreted.</p>
    /// <p>When the <code>RankOrder</code> field is <code>ASCENDING</code>, higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.</p>
    /// <p>When the <code>RankOrder</code> field is <code>DESCENDING</code>, lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.</p>
    /// <p>Only applies to <code>LONG</code> fields.</p>
    pub fn set_rank_order(mut self, input: ::std::option::Option<crate::types::Order>) -> Self {
        self.rank_order = input;
        self
    }
    /// <p>Determines how values should be interpreted.</p>
    /// <p>When the <code>RankOrder</code> field is <code>ASCENDING</code>, higher numbers are better. For example, a document with a rating score of 10 is higher ranking than a document with a rating score of 1.</p>
    /// <p>When the <code>RankOrder</code> field is <code>DESCENDING</code>, lower numbers are better. For example, in a task tracking application, a priority 1 task is more important than a priority 5 task.</p>
    /// <p>Only applies to <code>LONG</code> fields.</p>
    pub fn get_rank_order(&self) -> &::std::option::Option<crate::types::Order> {
        &self.rank_order
    }
    /// Adds a key-value pair to `value_importance_map`.
    ///
    /// To override the contents of this collection use [`set_value_importance_map`](Self::set_value_importance_map).
    ///
    /// <p>A list of values that should be given a different boost when they appear in the result list. For example, if you are boosting a field called "department", query terms that match the department field are boosted in the result. However, you can add entries from the department field to boost documents with those values higher.</p>
    /// <p>For example, you can add entries to the map with names of departments. If you add "HR",5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document. When those terms appear they are given the specified importance instead of the regular importance for the boost.</p>
    pub fn value_importance_map(mut self, k: impl ::std::convert::Into<::std::string::String>, v: i32) -> Self {
        let mut hash_map = self.value_importance_map.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.value_importance_map = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>A list of values that should be given a different boost when they appear in the result list. For example, if you are boosting a field called "department", query terms that match the department field are boosted in the result. However, you can add entries from the department field to boost documents with those values higher.</p>
    /// <p>For example, you can add entries to the map with names of departments. If you add "HR",5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document. When those terms appear they are given the specified importance instead of the regular importance for the boost.</p>
    pub fn set_value_importance_map(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, i32>>) -> Self {
        self.value_importance_map = input;
        self
    }
    /// <p>A list of values that should be given a different boost when they appear in the result list. For example, if you are boosting a field called "department", query terms that match the department field are boosted in the result. However, you can add entries from the department field to boost documents with those values higher.</p>
    /// <p>For example, you can add entries to the map with names of departments. If you add "HR",5 and "Legal",3 those departments are given special attention when they appear in the metadata of a document. When those terms appear they are given the specified importance instead of the regular importance for the boost.</p>
    pub fn get_value_importance_map(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, i32>> {
        &self.value_importance_map
    }
    /// Consumes the builder and constructs a [`Relevance`](crate::types::Relevance).
    pub fn build(self) -> crate::types::Relevance {
        crate::types::Relevance {
            freshness: self.freshness,
            importance: self.importance,
            duration: self.duration,
            rank_order: self.rank_order,
            value_importance_map: self.value_importance_map,
        }
    }
}