From 7e3b59e8c0ac5d7629a25cc35cc0fbba3f16aa50 Mon Sep 17 00:00:00 2001 From: neon_arch Date: Mon, 17 Jul 2023 13:03:20 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20remove=20the=20empty=5Fresu?= =?UTF-8?q?lt=5Fset=20option=20and=20helper=20functions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/results/aggregation_models.rs | 12 ------------ src/server/routes.rs | 6 ------ 2 files changed, 18 deletions(-) diff --git a/src/results/aggregation_models.rs b/src/results/aggregation_models.rs index 307cef9..6766fae 100644 --- a/src/results/aggregation_models.rs +++ b/src/results/aggregation_models.rs @@ -155,7 +155,6 @@ pub struct SearchResults { pub page_query: String, pub style: Style, pub engine_errors_info: Vec, - pub empty_result_set: bool, } impl SearchResults { @@ -179,7 +178,6 @@ impl SearchResults { page_query, style: Style::new("".to_string(), "".to_string()), engine_errors_info, - empty_result_set: false, } } @@ -187,14 +185,4 @@ impl SearchResults { pub fn add_style(&mut self, style: Style) { self.style = style; } - - /// A function which checks whether the results stored are empty or not. - pub fn is_empty_result_set(&self) -> bool { - self.results.is_empty() - } - - /// A setter function which sets the empty_result_set to true. - pub fn set_empty_result_set(&mut self) { - self.empty_result_set = true; - } } diff --git a/src/server/routes.rs b/src/server/routes.rs index de9ab77..e846fd9 100644 --- a/src/server/routes.rs +++ b/src/server/routes.rs @@ -161,12 +161,6 @@ async fn results( } }; results_json.add_style(config.style.clone()); - // check whether the results grabbed from the upstream engines are empty or - // not if they are empty then set the empty_result_set option to true in - // the result json. - if results_json.is_empty_result_set() { - results_json.set_empty_result_set(); - } redis_cache.cache_results(serde_json::to_string(&results_json)?, &url)?; Ok(results_json) }