neon_arch commited on
Commit
372a514
2 Parent(s): b299766 a8b6a9b

Merge pull request #165 from neon-mmd/patch-searx-results-on-first-page

Browse files
Files changed (4) hide show
  1. Cargo.lock +1 -1
  2. Cargo.toml +1 -1
  3. src/engines/duckduckgo.rs +1 -1
  4. src/engines/searx.rs +4 -1
Cargo.lock CHANGED
@@ -3511,7 +3511,7 @@ dependencies = [
3511
 
3512
  [[package]]
3513
  name = "websurfx"
3514
- version = "0.15.1"
3515
  dependencies = [
3516
  "actix-files",
3517
  "actix-web",
 
3511
 
3512
  [[package]]
3513
  name = "websurfx"
3514
+ version = "0.15.2"
3515
  dependencies = [
3516
  "actix-files",
3517
  "actix-web",
Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
  [package]
2
  name = "websurfx"
3
- version = "0.15.1"
4
  edition = "2021"
5
  description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
6
  repository = "https://github.com/neon-mmd/websurfx"
 
1
  [package]
2
  name = "websurfx"
3
+ version = "0.15.2"
4
  edition = "2021"
5
  description = "An open-source alternative to Searx that provides clean, ad-free, and organic results with incredible speed while keeping privacy and security in mind."
6
  repository = "https://github.com/neon-mmd/websurfx"
src/engines/duckduckgo.rs CHANGED
@@ -47,7 +47,7 @@ impl SearchEngine for DuckDuckGo {
47
  // Page number can be missing or empty string and so appropriate handling is required
48
  // so that upstream server recieves valid page number.
49
  let url: String = match page {
50
- 1 => {
51
  format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js")
52
  }
53
  _ => {
 
47
  // Page number can be missing or empty string and so appropriate handling is required
48
  // so that upstream server recieves valid page number.
49
  let url: String = match page {
50
+ 1 | 0 => {
51
  format!("https://html.duckduckgo.com/html/?q={query}&s=&dc=&v=1&o=json&api=/d.js")
52
  }
53
  _ => {
src/engines/searx.rs CHANGED
@@ -45,7 +45,10 @@ impl SearchEngine for Searx {
45
  ) -> Result<HashMap<String, RawSearchResult>, EngineError> {
46
  // Page number can be missing or empty string and so appropriate handling is required
47
  // so that upstream server recieves valid page number.
48
- let url: String = format!("https://searx.work/search?q={query}&pageno={page}");
 
 
 
49
 
50
  // initializing headers and adding appropriate headers.
51
  let mut header_map = HeaderMap::new();
 
45
  ) -> Result<HashMap<String, RawSearchResult>, EngineError> {
46
  // Page number can be missing or empty string and so appropriate handling is required
47
  // so that upstream server recieves valid page number.
48
+ let url: String = match page {
49
+ 0 | 1 => format!("https://searx.work/search?q={query}&pageno=1"),
50
+ _ => format!("https://searx.work/search?q={query}&pageno={page}"),
51
+ };
52
 
53
  // initializing headers and adding appropriate headers.
54
  let mut header_map = HeaderMap::new();