neon_arch commited on
Commit
5c8cbee
1 Parent(s): 81a21d0

✨ feat: implement code to pass safe search option in the json results (#210)

Browse files
Files changed (1) hide show
  1. src/models/aggregation_models.rs +8 -0
src/models/aggregation_models.rs CHANGED
@@ -122,6 +122,8 @@ 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 +149,7 @@ impl SearchResults {
147
  engine_errors_info: engine_errors_info.to_owned(),
148
  disallowed: Default::default(),
149
  filtered: Default::default(),
 
150
  }
151
  }
152
 
@@ -178,4 +181,9 @@ 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
  }
128
 
129
  impl SearchResults {
 
149
  engine_errors_info: engine_errors_info.to_owned(),
150
  disallowed: Default::default(),
151
  filtered: Default::default(),
152
+ safe_search_level: Default::default(),
153
  }
154
  }
155
 
 
181
  pub fn results(&mut self) -> Vec<SearchResult> {
182
  self.results.clone()
183
  }
184
+
185
+ /// A setter function to set the current page safe search level.
186
+ pub fn set_safe_search_level(&mut self, safe_search_level: u8) {
187
+ self.safe_search_level = safe_search_level;
188
+ }
189
  }