neon_arch commited on
Commit
5f052db
2 Parent(s): feb5ea8 ae2fdb5

Merge pull request #31 from alamin655/page_url

Browse files
Files changed (1) hide show
  1. src/server/routes.rs +6 -7
src/server/routes.rs CHANGED
@@ -81,11 +81,10 @@ pub async fn search(
81
  .insert_header(("location", "/"))
82
  .finish())
83
  } else {
84
- // Initialize the page url as an empty string
85
- let mut page_url = String::new();
86
 
87
- // Find whether the page is valid page number if not then return
88
- // the first page number and also construct the page_url accordingly
89
  let page = match params.page {
90
  Some(page_number) => {
91
  if page_number <= 1 {
@@ -99,7 +98,7 @@ pub async fn search(
99
  "http://{}:{}/search?q={}&page={}",
100
  config.binding_ip_addr, config.port, query, page_number
101
  );
102
-
103
  page_number
104
  }
105
  }
@@ -111,11 +110,11 @@ pub async fn search(
111
  req.uri(),
112
  1
113
  );
114
-
115
  1
116
  }
117
  };
118
-
119
  // fetch the cached results json.
120
  let cached_results_json = redis_cache.cached_results_json(&page_url);
121
  // check if fetched results was indeed fetched or it was an error and if so
 
81
  .insert_header(("location", "/"))
82
  .finish())
83
  } else {
84
+ let page_url: String; // Declare the page_url variable without initializing it
 
85
 
86
+ // ...
87
+
88
  let page = match params.page {
89
  Some(page_number) => {
90
  if page_number <= 1 {
 
98
  "http://{}:{}/search?q={}&page={}",
99
  config.binding_ip_addr, config.port, query, page_number
100
  );
101
+
102
  page_number
103
  }
104
  }
 
110
  req.uri(),
111
  1
112
  );
113
+
114
  1
115
  }
116
  };
117
+
118
  // fetch the cached results json.
119
  let cached_results_json = redis_cache.cached_results_json(&page_url);
120
  // check if fetched results was indeed fetched or it was an error and if so