瀏覽代碼

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

eg. pageno=1,21,41,... instead of 20,40,60,...
David A Roberts 8 年之前
父節點
當前提交
1e9dab08e6
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1
    1
      searx/engines/json_engine.py
  2. 1
    1
      searx/engines/xpath.py

+ 1
- 1
searx/engines/json_engine.py 查看文件

@@ -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 查看文件

@@ -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