0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-12-22 20:38:22 -05:00

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

This commit is contained in:
neon_arch 2023-09-22 19:51:10 +03:00
parent 81a21d0b26
commit 5c8cbee5d9

View File

@ -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<SearchResult> {
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;
}
}