Quellcode durchsuchen

[fix] behaviour for page_size>1 and first_page_num>0

eg. pageno=1,21,41,... instead of 20,40,60,...
David A Roberts vor 8 Jahren
Ursprung
Commit
1e9dab08e6
2 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 1
    1
      searx/engines/json_engine.py
  2. 1
    1
      searx/engines/xpath.py

+ 1
- 1
searx/engines/json_engine.py Datei anzeigen

@@ -81,7 +81,7 @@ def request(query, params):
81 81
 
82 82
     fp = {'query': query}
83 83
     if paging and search_url.find('{pageno}') >= 0:
84
-        fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size
84
+        fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num
85 85
 
86 86
     params['url'] = search_url.format(**fp)
87 87
     params['query'] = query

+ 1
- 1
searx/engines/xpath.py Datei anzeigen

@@ -87,7 +87,7 @@ def request(query, params):
87 87
 
88 88
     fp = {'query': query}
89 89
     if paging and search_url.find('{pageno}') >= 0:
90
-        fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size
90
+        fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num
91 91
 
92 92
     params['url'] = search_url.format(**fp)
93 93
     params['query'] = query