From 5c8cbee5d9dd36f90830e9c6ff3727697dd5c278 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Fri, 22 Sep 2023 19:51:10 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20implement=20code=20to=20pas?= =?UTF-8?q?s=20safe=20search=20option=20in=20the=20json=20results=20(#210)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/aggregation_models.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/models/aggregation_models.rs b/src/models/aggregation_models.rs index 656297f..bab7e62 100644 --- a/src/models/aggregation_models.rs +++ b/src/models/aggregation_models.rs @@ -122,6 +122,8 @@ pub struct SearchResults { /// search query was filtered when the safe search level set to 3 and it /// was present in the `Blocklist` file. pub filtered: bool, + /// Stores the safe search level `safesearch` provided in the search url. + pub safe_search_level: u8, } impl SearchResults { @@ -147,6 +149,7 @@ impl SearchResults { engine_errors_info: engine_errors_info.to_owned(), disallowed: Default::default(), filtered: Default::default(), + safe_search_level: Default::default(), } } @@ -178,4 +181,9 @@ impl SearchResults { pub fn results(&mut self) -> Vec { self.results.clone() } + + /// A setter function to set the current page safe search level. + pub fn set_safe_search_level(&mut self, safe_search_level: u8) { + self.safe_search_level = safe_search_level; + } }