0
0
mirror of https://github.com/neon-mmd/websurfx.git synced 2024-11-22 14:08:23 -05:00

feat: rename results_json to results

This commit is contained in:
neon_arch 2023-07-17 13:17:24 +03:00
parent 7e3b59e8c0
commit 987e667c3d

View File

@ -129,13 +129,13 @@ async fn results(
// check if fetched cache results was indeed fetched or it was an error and if so // check if fetched cache results was indeed fetched or it was an error and if so
// handle the data accordingly. // handle the data accordingly.
match cached_results_json { match cached_results_json {
Ok(results_json) => Ok(serde_json::from_str::<SearchResults>(&results_json).unwrap()), Ok(results) => Ok(serde_json::from_str::<SearchResults>(&results).unwrap()),
Err(_) => { Err(_) => {
// check if the cookie value is empty or not if it is empty then use the // check if the cookie value is empty or not if it is empty then use the
// default selected upstream search engines from the config file otherwise // default selected upstream search engines from the config file otherwise
// parse the non-empty cookie and grab the user selected engines from the // parse the non-empty cookie and grab the user selected engines from the
// UI and use that. // UI and use that.
let mut results_json: crate::results::aggregation_models::SearchResults = match req let mut results: crate::results::aggregation_models::SearchResults = match req
.cookie("appCookie") .cookie("appCookie")
{ {
Some(cookie_value) => { Some(cookie_value) => {
@ -160,9 +160,9 @@ async fn results(
.await? .await?
} }
}; };
results_json.add_style(config.style.clone()); results.add_style(config.style.clone());
redis_cache.cache_results(serde_json::to_string(&results_json)?, &url)?; redis_cache.cache_results(serde_json::to_string(&results)?, &url)?;
Ok(results_json) Ok(results)
} }
} }
} }