From 2db807368c549029a5f1fc8b20d0fcd56627cc5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 18 May 2017 21:34:54 +0200 Subject: [PATCH 1/3] [enh] make search type of mediawiki configurable --- searx/engines/mediawiki.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index 5a70204b1..82efbbdcb 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -21,6 +21,7 @@ categories = ['general'] language_support = True paging = True number_of_results = 1 +search_type = 'nearmatch' # possible values: title, text, nearmatch # search-url base_url = 'https://{language}.wikipedia.org/' @@ -30,7 +31,7 @@ search_postfix = 'w/api.php?action=query'\ '&format=json'\ '&sroffset={offset}'\ '&srlimit={limit}'\ - '&srwhat=nearmatch' # search for a near match in the title + '&srwhat={searchtype}' # search for a near match in the title # do search-request @@ -39,7 +40,8 @@ def request(query, params): string_args = dict(query=urlencode({'srsearch': query}), offset=offset, - limit=number_of_results) + limit=number_of_results, + searchtype=search_type) format_strings = list(Formatter().parse(base_url)) From 87f117d50efa93f2b1a7014e206c7e225d8d78c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 18 May 2017 21:35:19 +0200 Subject: [PATCH 2/3] [enh] add free software directory engine --- searx/settings.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/searx/settings.yml b/searx/settings.yml index d9426033e..303a612c3 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -209,6 +209,16 @@ engines: # Or you can use the html non-stable engine, activated by default engine : flickr_noapi + - name : free software directory + engine : mediawiki + shortcut : fsd + categories : it + base_url : https://directory.fsf.org/ + number_of_results : 5 + search_type : title + timeout : 5.0 + disabled : True + - name : frinkiac engine : frinkiac shortcut : frk From 2a9339f4b7f24bd7f5f05730c3c998ed2a66b675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9mi=20V=C3=A1nyi?= Date: Thu, 18 May 2017 22:04:31 +0200 Subject: [PATCH 3/3] [fix] add more description on possible search tpyes --- searx/engines/mediawiki.py | 2 +- searx/settings.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py index 82efbbdcb..33293cb43 100644 --- a/searx/engines/mediawiki.py +++ b/searx/engines/mediawiki.py @@ -31,7 +31,7 @@ search_postfix = 'w/api.php?action=query'\ '&format=json'\ '&sroffset={offset}'\ '&srlimit={limit}'\ - '&srwhat={searchtype}' # search for a near match in the title + '&srwhat={searchtype}' # do search-request diff --git a/searx/settings.yml b/searx/settings.yml index 303a612c3..af91a18f4 100644 --- a/searx/settings.yml +++ b/searx/settings.yml @@ -215,6 +215,8 @@ engines: categories : it base_url : https://directory.fsf.org/ number_of_results : 5 +# what part of a page matches the query string: title, text, nearmatch +# title - query matches title, text - query matches the text of page, nearmatch - nearmatch in title search_type : title timeout : 5.0 disabled : True