Quellcode durchsuchen

Merge pull request #663 from davidar/hoogle

Add Hoogle search engine
Adam Tauber vor 8 Jahren
Ursprung
Commit
acfe843ecd
4 geänderte Dateien mit 15 neuen und 3 gelöschten Zeilen
  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 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

+ 1
- 1
searx/results.py Datei anzeigen

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

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