From b428cedd7a7b3d392c3232346752bb836b865236 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Sat, 23 Sep 2023 12:48:01 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20new=20check=20value?= =?UTF-8?q?=20for=20no=20engine=20selected=20(#227)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/aggregation_models.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/models/aggregation_models.rs b/src/models/aggregation_models.rs index 656297f..72bbf08 100644 --- a/src/models/aggregation_models.rs +++ b/src/models/aggregation_models.rs @@ -122,6 +122,11 @@ 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, + /// Stores the flag option which holds the check value that whether any search engines were + /// selected or not. + pub no_engines_selected: bool, } impl SearchResults { @@ -147,6 +152,8 @@ impl SearchResults { engine_errors_info: engine_errors_info.to_owned(), disallowed: Default::default(), filtered: Default::default(), + safe_search_level: Default::default(), + no_engines_selected: Default::default(), } } @@ -178,4 +185,19 @@ 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; + } + + /// A getter function that gets the value of `no_engines_selected`. + pub fn no_engines_selected(&self) -> bool { + self.no_engines_selected + } + + /// A setter function to set the `no_engines_selected` to true. + pub fn set_no_engines_selected(&mut self) { + self.no_engines_selected = true; + } }