on master help sign in
Merge pull request #925 from kvch/free-software-directory

Add free software directory engine

commitf4287b7e212767cd208ac4142d27fe806a811f99 authorAdam Tauber <asciimoo@gmail.com> dateThu 18 May 2017, 22:06 (9 years ago) parent9ee8e552a9339f
2 files changed+16−2
searx/engines/mediawiki.py+4−2 searx/settings.yml+12
searx/engines/mediawiki.py+4−2
@@ -21,6 +21,7 @@ categories = ['general']
2121language_support = True
2222paging = True
2323number_of_results = 1
24+search_type = 'nearmatch' # possible values: title, text, nearmatch
2425
2526# search-url
2627base_url = 'https://{language}.wikipedia.org/'
@@ -30,7 +31,7 @@ search_postfix = 'w/api.php?action=query'\
3031 '&format=json'\
3132 '&sroffset={offset}'\
3233 '&srlimit={limit}'\
33− '&srwhat=nearmatch' # search for a near match in the title
34+ '&srwhat={searchtype}'
3435
3536
3637# do search-request
@@ -39,7 +40,8 @@ def request(query, params):
3940
4041 string_args = dict(query=urlencode({'srsearch': query}),
4142 offset=offset,
42− limit=number_of_results)
43+ limit=number_of_results,
44+ searchtype=search_type)
4345
4446 format_strings = list(Formatter().parse(base_url))
4547
searx/settings.yml+12
@@ -209,6 +209,18 @@ engines:
209209# Or you can use the html non-stable engine, activated by default
210210 engine : flickr_noapi
211211
212+ - name : free software directory
213+ engine : mediawiki
214+ shortcut : fsd
215+ categories : it
216+ base_url : https://directory.fsf.org/
217+ number_of_results : 5
218+# what part of a page matches the query string: title, text, nearmatch
219+# title - query matches title, text - query matches the text of page, nearmatch - nearmatch in title
220+ search_type : title
221+ timeout : 5.0
222+ disabled : True
223+
212224 - name : frinkiac
213225 engine : frinkiac
214226 shortcut : frk