mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-21 21:48:21 -05:00
Merge pull request #31 from alamin655/page_url
Fix page_url assignment in search route
This commit is contained in:
commit
5f052dbee8
@ -81,11 +81,10 @@ pub async fn search(
|
|||||||
.insert_header(("location", "/"))
|
.insert_header(("location", "/"))
|
||||||
.finish())
|
.finish())
|
||||||
} else {
|
} else {
|
||||||
// Initialize the page url as an empty string
|
let page_url: String; // Declare the page_url variable without initializing it
|
||||||
let mut page_url = String::new();
|
|
||||||
|
|
||||||
// Find whether the page is valid page number if not then return
|
// ...
|
||||||
// the first page number and also construct the page_url accordingly
|
|
||||||
let page = match params.page {
|
let page = match params.page {
|
||||||
Some(page_number) => {
|
Some(page_number) => {
|
||||||
if page_number <= 1 {
|
if page_number <= 1 {
|
||||||
@ -99,7 +98,7 @@ pub async fn search(
|
|||||||
"http://{}:{}/search?q={}&page={}",
|
"http://{}:{}/search?q={}&page={}",
|
||||||
config.binding_ip_addr, config.port, query, page_number
|
config.binding_ip_addr, config.port, query, page_number
|
||||||
);
|
);
|
||||||
|
|
||||||
page_number
|
page_number
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,11 +110,11 @@ pub async fn search(
|
|||||||
req.uri(),
|
req.uri(),
|
||||||
1
|
1
|
||||||
);
|
);
|
||||||
|
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// fetch the cached results json.
|
// fetch the cached results json.
|
||||||
let cached_results_json = redis_cache.cached_results_json(&page_url);
|
let cached_results_json = redis_cache.cached_results_json(&page_url);
|
||||||
// check if fetched results was indeed fetched or it was an error and if so
|
// check if fetched results was indeed fetched or it was an error and if so
|
||||||
|
Loading…
Reference in New Issue
Block a user