neon_arch commited on
Commit
987e667
1 Parent(s): 7e3b59e

✨ feat: rename `results_json` to `results`

Browse files
Files changed (1) hide show
  1. 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(results_json) => Ok(serde_json::from_str::<SearchResults>(&results_json).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_json: crate::results::aggregation_models::SearchResults = match req
139
  .cookie("appCookie")
140
  {
141
  Some(cookie_value) => {
@@ -160,9 +160,9 @@ async fn results(
160
  .await?
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
  }
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
  }