summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2016-08-16 10:36:05 +0200
committerGitHub <noreply@github.com>2016-08-16 10:36:05 +0200
commitacfe843ecd038ee3518f2afcee68bfedf4366366 (patch)
treea01c52560b388aa86d04a7081df6ba59c683cac7
parent104cdb7d03771d4eca5b5126532ccf47642bb9de (diff)
parent45120bc71190b03d549547a696e8aa019277200a (diff)
Merge pull request #663 from davidar/hoogle
Add Hoogle search engine
-rw-r--r--searx/engines/json_engine.py2
-rw-r--r--searx/engines/xpath.py2
-rw-r--r--searx/results.py2
-rw-r--r--searx/settings.yml12
4 files changed, 15 insertions, 3 deletions
diff --git a/searx/engines/json_engine.py b/searx/engines/json_engine.py
index a824c38e5..4604c3cac 100644
--- a/searx/engines/json_engine.py
+++ b/searx/engines/json_engine.py
@@ -81,7 +81,7 @@ def request(query, params):
fp = {'query': query}
if paging and search_url.find('{pageno}') >= 0:
- fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size
+ fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num
params['url'] = search_url.format(**fp)
params['query'] = query
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
index e701c02bf..e5c0c5bea 100644
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -87,7 +87,7 @@ def request(query, params):
fp = {'query': query}
if paging and search_url.find('{pageno}') >= 0:
- fp['pageno'] = (params['pageno'] + first_page_num - 1) * page_size
+ fp['pageno'] = (params['pageno'] - 1) * page_size + first_page_num
params['url'] = search_url.format(**fp)
params['query'] = query
diff --git a/searx/results.py b/searx/results.py
index 9a4ec0b28..32832f199 100644
--- a/searx/results.py
+++ b/searx/results.py
@@ -28,7 +28,7 @@ def compare_urls(url_a, url_b):
else:
host_b = url_b.netloc
- if host_a != host_b or url_a.query != url_b.query:
+ if host_a != host_b or url_a.query != url_b.query or url_a.fragment != url_b.fragment:
return False
# remove / from the end of the url if required
diff --git a/searx/settings.yml b/searx/settings.yml
index f0d33e50e..db5a4f7cb 100644
--- a/searx/settings.yml
+++ b/searx/settings.yml
@@ -281,6 +281,18 @@ engines:
disabled : True
shortcut : habr
+ - name : hoogle
+ engine : json_engine
+ paging : True
+ search_url : https://www.haskell.org/hoogle/?mode=json&hoogle={query}&start={pageno}
+ results_query : results
+ url_query : location
+ title_query : self
+ content_query : docs
+ page_size : 20
+ categories : it
+ shortcut : ho
+
- name : ina
engine : ina
shortcut : in