prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Add a software categorie and add the Free software directory search engine
  Shame on me I forgot to ask this.
  I am a volunteer on the [FSD](https://directory.fsf.org/wiki/Main_Page) (Free software directory)
  It would be nice if people could look for free/libre software in the searx engine.
  When possible could someone please add the free software directory so that people can easily find free software.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `searx/engines/mediawiki.py`
  Content:
  ```
  1 """
  2  general mediawiki-engine (Web)
  3 
  4  @website     websites built on mediawiki (https://www.mediawiki.org)
  5  @provide-api yes (http://www.mediawiki.org/wiki/API:Search)
  6 
  7  @using-api   yes
  8  @results     JSON
  9  @stable      yes
  10  @parse       url, title
  11 
  12  @todo        content
  13 """
  14 
  15 from json import loads
  16 from string import Formatter
  17 from searx.url_utils import urlencode, quote
  18 
  19 # engine dependent config
  20 categories = ['general']
  21 language_support = True
  22 paging = True
  23 number_of_results = 1
  24 
  25 # search-url
  26 base_url = 'https://{language}.wikipedia.org/'
  27 search_postfix = 'w/api.php?action=query'\
  28     '&list=search'\
  29     '&{query}'\
  30     '&format=json'\
  31     '&sroffset={offset}'\
  32     '&srlimit={limit}'\
  33     '&srwhat=nearmatch'  # search for a near match in the title
  34 
  35 
  36 # do search-request
  37 def request(query, params):
  38     offset = (params['pageno'] - 1) * number_of_results
  39 
  40     string_args = dict(query=urlencode({'srsearch': query}),
  41                        offset=offset,
  42                        limit=number_of_results)
  43 
  44     format_strings = list(Formatter().parse(base_url))
  45 
  46     if params['language'] == 'all':
  47         language = 'en'
  48     else:
  49         language = params['language'].split('-')[0]
  50 
  51     # format_string [('https://', 'language', '', None), ('.wikipedia.org/', None, None, None)]
  52     if any(x[1] == 'language' for x in format_strings):
  53         string_args['language'] = language
  54 
  55     # write search-language back to params, required in response
  56     params['language'] = language
  57 
  58     search_url = base_url + search_postfix
  59 
  60     params['url'] = search_url.format(**string_args)
  61 
  62     return params
  63 
  64 
  65 # get response from search-request
  66 def response(resp):
  67     results = []
  68 
  69     search_results = loads(resp.text)
  70 
  71     # return empty array if there are no results
  72     if not search_results.get('query', {}).get('search'):
  73         return []
  74 
  75     # parse results
  76     for result in search_results['query']['search']:
  77         if result.get('snippet', '').startswith('#REDIRECT'):
  78             continue
  79         url = base_url.format(language=resp.search_params['language']) +\
  80             'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8'))
  81 
  82         # append result
  83         results.append({'url': url,
  84                         'title': result['title'],
  85                         'content': ''})
  86 
  87     # return results
  88     return results
  89
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py
  --- a/searx/engines/mediawiki.py
  +++ b/searx/engines/mediawiki.py
  @@ -21,6 +21,7 @@
   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 @@
       '&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 @@
   
       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))
  
verification_info: {"golden_diff": "diff --git a/searx/engines/mediawiki.py b/searx/engines/mediawiki.py\n--- a/searx/engines/mediawiki.py\n+++ b/searx/engines/mediawiki.py\n@@ -21,6 +21,7 @@\n language_support = True\n paging = True\n number_of_results = 1\n+search_type = 'nearmatch' # possible values: title, text, nearmatch\n \n # search-url\n base_url = 'https://{language}.wikipedia.org/'\n@@ -30,7 +31,7 @@\n     '&format=json'\\\n     '&sroffset={offset}'\\\n     '&srlimit={limit}'\\\n-    '&srwhat=nearmatch'  # search for a near match in the title\n+    '&srwhat={searchtype}'\n \n \n # do search-request\n@@ -39,7 +40,8 @@\n \n     string_args = dict(query=urlencode({'srsearch': query}),\n                        offset=offset,\n-                       limit=number_of_results)\n+                       limit=number_of_results,\n+                       searchtype=search_type)\n \n     format_strings = list(Formatter().parse(base_url))\n", "issue": "Add a software categorie and add the Free software directory search engine\nShame on me I forgot to ask this.\r\nI am a volunteer on the [FSD](https://directory.fsf.org/wiki/Main_Page) (Free software directory)\r\nIt would be nice if people could look for free/libre software in the searx engine.\r\nWhen possible could someone please add the free software directory so that people can easily find free software.\n", "before_files": [{"content": "\"\"\"\n general mediawiki-engine (Web)\n\n @website     websites built on mediawiki (https://www.mediawiki.org)\n @provide-api yes (http://www.mediawiki.org/wiki/API:Search)\n\n @using-api   yes\n @results     JSON\n @stable      yes\n @parse       url, title\n\n @todo        content\n\"\"\"\n\nfrom json import loads\nfrom string import Formatter\nfrom searx.url_utils import urlencode, quote\n\n# engine dependent config\ncategories = ['general']\nlanguage_support = True\npaging = True\nnumber_of_results = 1\n\n# search-url\nbase_url = 'https://{language}.wikipedia.org/'\nsearch_postfix = 'w/api.php?action=query'\\\n    '&list=search'\\\n    '&{query}'\\\n    '&format=json'\\\n    '&sroffset={offset}'\\\n    '&srlimit={limit}'\\\n    '&srwhat=nearmatch'  # search for a near match in the title\n\n\n# do search-request\ndef request(query, params):\n    offset = (params['pageno'] - 1) * number_of_results\n\n    string_args = dict(query=urlencode({'srsearch': query}),\n                       offset=offset,\n                       limit=number_of_results)\n\n    format_strings = list(Formatter().parse(base_url))\n\n    if params['language'] == 'all':\n        language = 'en'\n    else:\n        language = params['language'].split('-')[0]\n\n    # format_string [('https://', 'language', '', None), ('.wikipedia.org/', None, None, None)]\n    if any(x[1] == 'language' for x in format_strings):\n        string_args['language'] = language\n\n    # write search-language back to params, required in response\n    params['language'] = language\n\n    search_url = base_url + search_postfix\n\n    params['url'] = search_url.format(**string_args)\n\n    return params\n\n\n# get response from search-request\ndef response(resp):\n    results = []\n\n    search_results = loads(resp.text)\n\n    # return empty array if there are no results\n    if not search_results.get('query', {}).get('search'):\n        return []\n\n    # parse results\n    for result in search_results['query']['search']:\n        if result.get('snippet', '').startswith('#REDIRECT'):\n            continue\n        url = base_url.format(language=resp.search_params['language']) +\\\n            'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8'))\n\n        # append result\n        results.append({'url': url,\n                        'title': result['title'],\n                        'content': ''})\n\n    # return results\n    return results\n", "path": "searx/engines/mediawiki.py"}], "after_files": [{"content": "\"\"\"\n general mediawiki-engine (Web)\n\n @website     websites built on mediawiki (https://www.mediawiki.org)\n @provide-api yes (http://www.mediawiki.org/wiki/API:Search)\n\n @using-api   yes\n @results     JSON\n @stable      yes\n @parse       url, title\n\n @todo        content\n\"\"\"\n\nfrom json import loads\nfrom string import Formatter\nfrom searx.url_utils import urlencode, quote\n\n# engine dependent config\ncategories = ['general']\nlanguage_support = True\npaging = True\nnumber_of_results = 1\nsearch_type = 'nearmatch' # possible values: title, text, nearmatch\n\n# search-url\nbase_url = 'https://{language}.wikipedia.org/'\nsearch_postfix = 'w/api.php?action=query'\\\n    '&list=search'\\\n    '&{query}'\\\n    '&format=json'\\\n    '&sroffset={offset}'\\\n    '&srlimit={limit}'\\\n    '&srwhat={searchtype}'\n\n\n# do search-request\ndef request(query, params):\n    offset = (params['pageno'] - 1) * number_of_results\n\n    string_args = dict(query=urlencode({'srsearch': query}),\n                       offset=offset,\n                       limit=number_of_results,\n                       searchtype=search_type)\n\n    format_strings = list(Formatter().parse(base_url))\n\n    if params['language'] == 'all':\n        language = 'en'\n    else:\n        language = params['language'].split('-')[0]\n\n    # format_string [('https://', 'language', '', None), ('.wikipedia.org/', None, None, None)]\n    if any(x[1] == 'language' for x in format_strings):\n        string_args['language'] = language\n\n    # write search-language back to params, required in response\n    params['language'] = language\n\n    search_url = base_url + search_postfix\n\n    params['url'] = search_url.format(**string_args)\n\n    return params\n\n\n# get response from search-request\ndef response(resp):\n    results = []\n\n    search_results = loads(resp.text)\n\n    # return empty array if there are no results\n    if not search_results.get('query', {}).get('search'):\n        return []\n\n    # parse results\n    for result in search_results['query']['search']:\n        if result.get('snippet', '').startswith('#REDIRECT'):\n            continue\n        url = base_url.format(language=resp.search_params['language']) +\\\n            'wiki/' + quote(result['title'].replace(' ', '_').encode('utf-8'))\n\n        # append result\n        results.append({'url': url,\n                        'title': result['title'],\n                        'content': ''})\n\n    # return results\n    return results\n", "path": "searx/engines/mediawiki.py"}]}