1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>The result of a <code>Search</code> request. Contains the documents that match the specified search criteria and any requested fields, highlights, and facet information.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct SearchOutput {
    /// <p>The status information returned for the search request.</p>
    pub status: ::std::option::Option<crate::types::SearchStatus>,
    /// <p>The documents that match the search criteria.</p>
    pub hits: ::std::option::Option<crate::types::Hits>,
    /// <p>The requested facet information.</p>
    pub facets: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>,
    /// <p>The requested field statistics information.</p>
    pub stats: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>,
    _request_id: Option<String>,
}
impl SearchOutput {
    /// <p>The status information returned for the search request.</p>
    pub fn status(&self) -> ::std::option::Option<&crate::types::SearchStatus> {
        self.status.as_ref()
    }
    /// <p>The documents that match the search criteria.</p>
    pub fn hits(&self) -> ::std::option::Option<&crate::types::Hits> {
        self.hits.as_ref()
    }
    /// <p>The requested facet information.</p>
    pub fn facets(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>> {
        self.facets.as_ref()
    }
    /// <p>The requested field statistics information.</p>
    pub fn stats(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::FieldStats>> {
        self.stats.as_ref()
    }
}
impl ::aws_types::request_id::RequestId for SearchOutput {
    fn request_id(&self) -> Option<&str> {
        self._request_id.as_deref()
    }
}
impl SearchOutput {
    /// Creates a new builder-style object to manufacture [`SearchOutput`](crate::operation::search::SearchOutput).
    pub fn builder() -> crate::operation::search::builders::SearchOutputBuilder {
        crate::operation::search::builders::SearchOutputBuilder::default()
    }
}

/// A builder for [`SearchOutput`](crate::operation::search::SearchOutput).
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
pub struct SearchOutputBuilder {
    pub(crate) status: ::std::option::Option<crate::types::SearchStatus>,
    pub(crate) hits: ::std::option::Option<crate::types::Hits>,
    pub(crate) facets: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>,
    pub(crate) stats: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>,
    _request_id: Option<String>,
}
impl SearchOutputBuilder {
    /// <p>The status information returned for the search request.</p>
    pub fn status(mut self, input: crate::types::SearchStatus) -> Self {
        self.status = ::std::option::Option::Some(input);
        self
    }
    /// <p>The status information returned for the search request.</p>
    pub fn set_status(mut self, input: ::std::option::Option<crate::types::SearchStatus>) -> Self {
        self.status = input;
        self
    }
    /// <p>The status information returned for the search request.</p>
    pub fn get_status(&self) -> &::std::option::Option<crate::types::SearchStatus> {
        &self.status
    }
    /// <p>The documents that match the search criteria.</p>
    pub fn hits(mut self, input: crate::types::Hits) -> Self {
        self.hits = ::std::option::Option::Some(input);
        self
    }
    /// <p>The documents that match the search criteria.</p>
    pub fn set_hits(mut self, input: ::std::option::Option<crate::types::Hits>) -> Self {
        self.hits = input;
        self
    }
    /// <p>The documents that match the search criteria.</p>
    pub fn get_hits(&self) -> &::std::option::Option<crate::types::Hits> {
        &self.hits
    }
    /// Adds a key-value pair to `facets`.
    ///
    /// To override the contents of this collection use [`set_facets`](Self::set_facets).
    ///
    /// <p>The requested facet information.</p>
    pub fn facets(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::BucketInfo) -> Self {
        let mut hash_map = self.facets.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.facets = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The requested facet information.</p>
    pub fn set_facets(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>) -> Self {
        self.facets = input;
        self
    }
    /// <p>The requested facet information.</p>
    pub fn get_facets(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>> {
        &self.facets
    }
    /// Adds a key-value pair to `stats`.
    ///
    /// To override the contents of this collection use [`set_stats`](Self::set_stats).
    ///
    /// <p>The requested field statistics information.</p>
    pub fn stats(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::FieldStats) -> Self {
        let mut hash_map = self.stats.unwrap_or_default();
        hash_map.insert(k.into(), v);
        self.stats = ::std::option::Option::Some(hash_map);
        self
    }
    /// <p>The requested field statistics information.</p>
    pub fn set_stats(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>) -> Self {
        self.stats = input;
        self
    }
    /// <p>The requested field statistics information.</p>
    pub fn get_stats(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>> {
        &self.stats
    }
    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
        self._request_id = Some(request_id.into());
        self
    }

    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
        self._request_id = request_id;
        self
    }
    /// Consumes the builder and constructs a [`SearchOutput`](crate::operation::search::SearchOutput).
    pub fn build(self) -> crate::operation::search::SearchOutput {
        crate::operation::search::SearchOutput {
            status: self.status,
            hits: self.hits,
            facets: self.facets,
            stats: self.stats,
            _request_id: self._request_id,
        }
    }
}