neon_arch commited on
Commit
b428ced
1 Parent(s): 9271090

✨ feat: add new check value for no engine selected (#227)

Browse files
Files changed (1) hide show
  1. src/models/aggregation_models.rs +22 -0
src/models/aggregation_models.rs CHANGED
@@ -122,6 +122,11 @@ pub struct SearchResults {
122
  /// search query was filtered when the safe search level set to 3 and it
123
  /// was present in the `Blocklist` file.
124
  pub filtered: bool,
 
 
 
 
 
125
  }
126
 
127
  impl SearchResults {
@@ -147,6 +152,8 @@ impl SearchResults {
147
  engine_errors_info: engine_errors_info.to_owned(),
148
  disallowed: Default::default(),
149
  filtered: Default::default(),
 
 
150
  }
151
  }
152
 
@@ -178,4 +185,19 @@ impl SearchResults {
178
  pub fn results(&mut self) -> Vec<SearchResult> {
179
  self.results.clone()
180
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  }
 
122
  /// search query was filtered when the safe search level set to 3 and it
123
  /// was present in the `Blocklist` file.
124
  pub filtered: bool,
125
+ /// Stores the safe search level `safesearch` provided in the search url.
126
+ pub safe_search_level: u8,
127
+ /// Stores the flag option which holds the check value that whether any search engines were
128
+ /// selected or not.
129
+ pub no_engines_selected: bool,
130
  }
131
 
132
  impl SearchResults {
 
152
  engine_errors_info: engine_errors_info.to_owned(),
153
  disallowed: Default::default(),
154
  filtered: Default::default(),
155
+ safe_search_level: Default::default(),
156
+ no_engines_selected: Default::default(),
157
  }
158
  }
159
 
 
185
  pub fn results(&mut self) -> Vec<SearchResult> {
186
  self.results.clone()
187
  }
188
+
189
+ /// A setter function to set the current page safe search level.
190
+ pub fn set_safe_search_level(&mut self, safe_search_level: u8) {
191
+ self.safe_search_level = safe_search_level;
192
+ }
193
+
194
+ /// A getter function that gets the value of `no_engines_selected`.
195
+ pub fn no_engines_selected(&self) -> bool {
196
+ self.no_engines_selected
197
+ }
198
+
199
+ /// A setter function to set the `no_engines_selected` to true.
200
+ pub fn set_no_engines_selected(&mut self) {
201
+ self.no_engines_selected = true;
202
+ }
203
  }