aws_sdk_cloudsearchdomain/operation/search/
_search_output.rs

1// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
2
3/// <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>
4#[non_exhaustive]
5#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
6pub struct SearchOutput {
7    /// <p>The status information returned for the search request.</p>
8    pub status: ::std::option::Option<crate::types::SearchStatus>,
9    /// <p>The documents that match the search criteria.</p>
10    pub hits: ::std::option::Option<crate::types::Hits>,
11    /// <p>The requested facet information.</p>
12    pub facets: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>,
13    /// <p>The requested field statistics information.</p>
14    pub stats: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>,
15    _request_id: Option<String>,
16}
17impl SearchOutput {
18    /// <p>The status information returned for the search request.</p>
19    pub fn status(&self) -> ::std::option::Option<&crate::types::SearchStatus> {
20        self.status.as_ref()
21    }
22    /// <p>The documents that match the search criteria.</p>
23    pub fn hits(&self) -> ::std::option::Option<&crate::types::Hits> {
24        self.hits.as_ref()
25    }
26    /// <p>The requested facet information.</p>
27    pub fn facets(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>> {
28        self.facets.as_ref()
29    }
30    /// <p>The requested field statistics information.</p>
31    pub fn stats(&self) -> ::std::option::Option<&::std::collections::HashMap<::std::string::String, crate::types::FieldStats>> {
32        self.stats.as_ref()
33    }
34}
35impl ::aws_types::request_id::RequestId for SearchOutput {
36    fn request_id(&self) -> Option<&str> {
37        self._request_id.as_deref()
38    }
39}
40impl SearchOutput {
41    /// Creates a new builder-style object to manufacture [`SearchOutput`](crate::operation::search::SearchOutput).
42    pub fn builder() -> crate::operation::search::builders::SearchOutputBuilder {
43        crate::operation::search::builders::SearchOutputBuilder::default()
44    }
45}
46
47/// A builder for [`SearchOutput`](crate::operation::search::SearchOutput).
48#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
49#[non_exhaustive]
50pub struct SearchOutputBuilder {
51    pub(crate) status: ::std::option::Option<crate::types::SearchStatus>,
52    pub(crate) hits: ::std::option::Option<crate::types::Hits>,
53    pub(crate) facets: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>,
54    pub(crate) stats: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>,
55    _request_id: Option<String>,
56}
57impl SearchOutputBuilder {
58    /// <p>The status information returned for the search request.</p>
59    pub fn status(mut self, input: crate::types::SearchStatus) -> Self {
60        self.status = ::std::option::Option::Some(input);
61        self
62    }
63    /// <p>The status information returned for the search request.</p>
64    pub fn set_status(mut self, input: ::std::option::Option<crate::types::SearchStatus>) -> Self {
65        self.status = input;
66        self
67    }
68    /// <p>The status information returned for the search request.</p>
69    pub fn get_status(&self) -> &::std::option::Option<crate::types::SearchStatus> {
70        &self.status
71    }
72    /// <p>The documents that match the search criteria.</p>
73    pub fn hits(mut self, input: crate::types::Hits) -> Self {
74        self.hits = ::std::option::Option::Some(input);
75        self
76    }
77    /// <p>The documents that match the search criteria.</p>
78    pub fn set_hits(mut self, input: ::std::option::Option<crate::types::Hits>) -> Self {
79        self.hits = input;
80        self
81    }
82    /// <p>The documents that match the search criteria.</p>
83    pub fn get_hits(&self) -> &::std::option::Option<crate::types::Hits> {
84        &self.hits
85    }
86    /// Adds a key-value pair to `facets`.
87    ///
88    /// To override the contents of this collection use [`set_facets`](Self::set_facets).
89    ///
90    /// <p>The requested facet information.</p>
91    pub fn facets(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::BucketInfo) -> Self {
92        let mut hash_map = self.facets.unwrap_or_default();
93        hash_map.insert(k.into(), v);
94        self.facets = ::std::option::Option::Some(hash_map);
95        self
96    }
97    /// <p>The requested facet information.</p>
98    pub fn set_facets(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>>) -> Self {
99        self.facets = input;
100        self
101    }
102    /// <p>The requested facet information.</p>
103    pub fn get_facets(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::BucketInfo>> {
104        &self.facets
105    }
106    /// Adds a key-value pair to `stats`.
107    ///
108    /// To override the contents of this collection use [`set_stats`](Self::set_stats).
109    ///
110    /// <p>The requested field statistics information.</p>
111    pub fn stats(mut self, k: impl ::std::convert::Into<::std::string::String>, v: crate::types::FieldStats) -> Self {
112        let mut hash_map = self.stats.unwrap_or_default();
113        hash_map.insert(k.into(), v);
114        self.stats = ::std::option::Option::Some(hash_map);
115        self
116    }
117    /// <p>The requested field statistics information.</p>
118    pub fn set_stats(mut self, input: ::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>>) -> Self {
119        self.stats = input;
120        self
121    }
122    /// <p>The requested field statistics information.</p>
123    pub fn get_stats(&self) -> &::std::option::Option<::std::collections::HashMap<::std::string::String, crate::types::FieldStats>> {
124        &self.stats
125    }
126    pub(crate) fn _request_id(mut self, request_id: impl Into<String>) -> Self {
127        self._request_id = Some(request_id.into());
128        self
129    }
130
131    pub(crate) fn _set_request_id(&mut self, request_id: Option<String>) -> &mut Self {
132        self._request_id = request_id;
133        self
134    }
135    /// Consumes the builder and constructs a [`SearchOutput`](crate::operation::search::SearchOutput).
136    pub fn build(self) -> crate::operation::search::SearchOutput {
137        crate::operation::search::SearchOutput {
138            status: self.status,
139            hits: self.hits,
140            facets: self.facets,
141            stats: self.stats,
142            _request_id: self._request_id,
143        }
144    }
145}