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 View File

@@ -21,6 +21,7 @@ categories = ['general']
21 21
 language_support = True
22 22
 paging = True
23 23
 number_of_results = 1
24
+search_type = 'nearmatch' # possible values: title, text, nearmatch
24 25
 
25 26
 # search-url
26 27
 base_url = 'https://{language}.wikipedia.org/'
@@ -30,7 +31,7 @@ search_postfix = 'w/api.php?action=query'\
30 31
     '&format=json'\
31 32
     '&sroffset={offset}'\
32 33
     '&srlimit={limit}'\
33
-    '&srwhat=nearmatch'  # search for a near match in the title
34
+    '&srwhat={searchtype}'
34 35
 
35 36
 
36 37
 # do search-request
@@ -39,7 +40,8 @@ def request(query, params):
39 40
 
40 41
     string_args = dict(query=urlencode({'srsearch': query}),
41 42
                        offset=offset,
42
-                       limit=number_of_results)
43
+                       limit=number_of_results,
44
+                       searchtype=search_type)
43 45
 
44 46
     format_strings = list(Formatter().parse(base_url))
45 47
 

+ 12
- 0
searx/settings.yml View File

@@ -209,6 +209,18 @@ engines:
209 209
 # Or you can use the html non-stable engine, activated by default
210 210
     engine : flickr_noapi
211 211
 
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
+
212 224
   - name : frinkiac
213 225
     engine : frinkiac
214 226
     shortcut : frk