Browse Source

Merge pull request #663 from davidar/hoogle

Add Hoogle search engine
Adam Tauber 8 years ago
parent
commit
acfe843ecd
4 changed files with 15 additions and 3 deletions
  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 View File

81
 
81
 
82
     fp = {'query': query}
82
     fp = {'query': query}
83
     if paging and search_url.find('{pageno}') >= 0:
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
     params['url'] = search_url.format(**fp)
86
     params['url'] = search_url.format(**fp)
87
     params['query'] = query
87
     params['query'] = query

+ 1
- 1
searx/engines/xpath.py View File

87
 
87
 
88
     fp = {'query': query}
88
     fp = {'query': query}
89
     if paging and search_url.find('{pageno}') >= 0:
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
     params['url'] = search_url.format(**fp)
92
     params['url'] = search_url.format(**fp)
93
     params['query'] = query
93
     params['query'] = query

+ 1
- 1
searx/results.py View File

28
     else:
28
     else:
29
         host_b = url_b.netloc
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
         return False
32
         return False
33
 
33
 
34
     # remove / from the end of the url if required
34
     # remove / from the end of the url if required

+ 12
- 0
searx/settings.yml View File

281
     disabled : True
281
     disabled : True
282
     shortcut : habr
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
   - name : ina
296
   - name : ina
285
     engine : ina
297
     engine : ina
286
     shortcut : in
298
     shortcut : in