Преглед на файлове

Merge pull request #663 from davidar/hoogle

Add Hoogle search engine
Adam Tauber преди 8 години
родител
ревизия
acfe843ecd
променени са 4 файла, в които са добавени 15 реда и са изтрити 3 реда
  1. 1
    1
      searx/engines/json_engine.py
  2. 1
    1
      searx/engines/xpath.py
  3. 1
    1
      searx/results.py
  4. 12
    0
      searx/settings.yml

+ 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

+ 1
- 1
searx/results.py Целия файл

@@ -28,7 +28,7 @@ def compare_urls(url_a, url_b):
28 28
     else:
29 29
         host_b = url_b.netloc
30 30
 
31
-    if host_a != host_b or url_a.query != url_b.query:
31
+    if host_a != host_b or url_a.query != url_b.query or url_a.fragment != url_b.fragment:
32 32
         return False
33 33
 
34 34
     # remove / from the end of the url if required

+ 12
- 0
searx/settings.yml Целия файл

@@ -281,6 +281,18 @@ engines:
281 281
     disabled : True
282 282
     shortcut : habr
283 283
 
284
+  - name : hoogle
285
+    engine : json_engine
286
+    paging : True
287
+    search_url : https://www.haskell.org/hoogle/?mode=json&hoogle={query}&start={pageno}
288
+    results_query : results
289
+    url_query : location
290
+    title_query : self
291
+    content_query : docs
292
+    page_size : 20
293
+    categories : it
294
+    shortcut : ho
295
+
284 296
   - name : ina
285 297
     engine : ina
286 298
     shortcut : in