Browse Source

Merge pull request #925 from kvch/free-software-directory

Add free software directory engine
Adam Tauber 8 years ago
parent
commit
f4287b7e21
2 changed files with 16 additions and 2 deletions
  1. 4 2
      searx/engines/mediawiki.py
  2. 12 0
      searx/settings.yml

+ 4 - 2
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}'
 
 
 # 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))
 

+ 12 - 0
searx/settings.yml

@@ -209,6 +209,18 @@ 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
+# 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
+
   - name : frinkiac
     engine : frinkiac
     shortcut : frk