Spaces:
Runtime error
Runtime error
neon_arch
commited on
Commit
•
7e3b59e
1
Parent(s):
c5fca32
✨ feat: remove the empty_result_set option and helper functions
Browse files- src/results/aggregation_models.rs +0 -12
- src/server/routes.rs +0 -6
src/results/aggregation_models.rs
CHANGED
@@ -155,7 +155,6 @@ pub struct SearchResults {
|
|
155 |
pub page_query: String,
|
156 |
pub style: Style,
|
157 |
pub engine_errors_info: Vec<EngineErrorInfo>,
|
158 |
-
pub empty_result_set: bool,
|
159 |
}
|
160 |
|
161 |
impl SearchResults {
|
@@ -179,7 +178,6 @@ impl SearchResults {
|
|
179 |
page_query,
|
180 |
style: Style::new("".to_string(), "".to_string()),
|
181 |
engine_errors_info,
|
182 |
-
empty_result_set: false,
|
183 |
}
|
184 |
}
|
185 |
|
@@ -187,14 +185,4 @@ impl SearchResults {
|
|
187 |
pub fn add_style(&mut self, style: Style) {
|
188 |
self.style = style;
|
189 |
}
|
190 |
-
|
191 |
-
/// A function which checks whether the results stored are empty or not.
|
192 |
-
pub fn is_empty_result_set(&self) -> bool {
|
193 |
-
self.results.is_empty()
|
194 |
-
}
|
195 |
-
|
196 |
-
/// A setter function which sets the empty_result_set to true.
|
197 |
-
pub fn set_empty_result_set(&mut self) {
|
198 |
-
self.empty_result_set = true;
|
199 |
-
}
|
200 |
}
|
|
|
155 |
pub page_query: String,
|
156 |
pub style: Style,
|
157 |
pub engine_errors_info: Vec<EngineErrorInfo>,
|
|
|
158 |
}
|
159 |
|
160 |
impl SearchResults {
|
|
|
178 |
page_query,
|
179 |
style: Style::new("".to_string(), "".to_string()),
|
180 |
engine_errors_info,
|
|
|
181 |
}
|
182 |
}
|
183 |
|
|
|
185 |
pub fn add_style(&mut self, style: Style) {
|
186 |
self.style = style;
|
187 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
188 |
}
|
src/server/routes.rs
CHANGED
@@ -161,12 +161,6 @@ async fn results(
|
|
161 |
}
|
162 |
};
|
163 |
results_json.add_style(config.style.clone());
|
164 |
-
// check whether the results grabbed from the upstream engines are empty or
|
165 |
-
// not if they are empty then set the empty_result_set option to true in
|
166 |
-
// the result json.
|
167 |
-
if results_json.is_empty_result_set() {
|
168 |
-
results_json.set_empty_result_set();
|
169 |
-
}
|
170 |
redis_cache.cache_results(serde_json::to_string(&results_json)?, &url)?;
|
171 |
Ok(results_json)
|
172 |
}
|
|
|
161 |
}
|
162 |
};
|
163 |
results_json.add_style(config.style.clone());
|
|
|
|
|
|
|
|
|
|
|
|
|
164 |
redis_cache.cache_results(serde_json::to_string(&results_json)?, &url)?;
|
165 |
Ok(results_json)
|
166 |
}
|