neon_arch
commited on
Commit
•
987e667
1
Parent(s):
7e3b59e
✨ feat: rename `results_json` to `results`
Browse files- src/server/routes.rs +5 -5
src/server/routes.rs
CHANGED
@@ -129,13 +129,13 @@ async fn results(
|
|
129 |
// check if fetched cache results was indeed fetched or it was an error and if so
|
130 |
// handle the data accordingly.
|
131 |
match cached_results_json {
|
132 |
-
Ok(
|
133 |
Err(_) => {
|
134 |
// check if the cookie value is empty or not if it is empty then use the
|
135 |
// default selected upstream search engines from the config file otherwise
|
136 |
// parse the non-empty cookie and grab the user selected engines from the
|
137 |
// UI and use that.
|
138 |
-
let mut
|
139 |
.cookie("appCookie")
|
140 |
{
|
141 |
Some(cookie_value) => {
|
@@ -160,9 +160,9 @@ async fn results(
|
|
160 |
.await?
|
161 |
}
|
162 |
};
|
163 |
-
|
164 |
-
redis_cache.cache_results(serde_json::to_string(&
|
165 |
-
Ok(
|
166 |
}
|
167 |
}
|
168 |
}
|
|
|
129 |
// check if fetched cache results was indeed fetched or it was an error and if so
|
130 |
// handle the data accordingly.
|
131 |
match cached_results_json {
|
132 |
+
Ok(results) => Ok(serde_json::from_str::<SearchResults>(&results).unwrap()),
|
133 |
Err(_) => {
|
134 |
// check if the cookie value is empty or not if it is empty then use the
|
135 |
// default selected upstream search engines from the config file otherwise
|
136 |
// parse the non-empty cookie and grab the user selected engines from the
|
137 |
// UI and use that.
|
138 |
+
let mut results: crate::results::aggregation_models::SearchResults = match req
|
139 |
.cookie("appCookie")
|
140 |
{
|
141 |
Some(cookie_value) => {
|
|
|
160 |
.await?
|
161 |
}
|
162 |
};
|
163 |
+
results.add_style(config.style.clone());
|
164 |
+
redis_cache.cache_results(serde_json::to_string(&results)?, &url)?;
|
165 |
+
Ok(results)
|
166 |
}
|
167 |
}
|
168 |
}
|