Repository: searx/searx

Issue:
Can't select Mojeek as engine
Installed and updated to the latest version of searx 0.17 instablled on vps with Ubuntu 18.04 LTS

Mojeek is not visible in preference>engines

Also !mjk doesn't work

In settings.yml it is visible



Discussion:
Sorry for unrelated question but why are you not filling the issue template? Is it too long or difficult to fill?
v0.17
```
 git log -1
commit c1a97322687546a066dacffb472d87a86eaadbd4 (HEAD -> master, origin/master, origin/HEAD)
Merge: 13d30047 34df0f79
Author: Alexandre Flament <alex@al-f.net>
Date:   Mon Dec 7 20:26:00 2020 +0100

    Merge pull request #2364 from dalf/fix-youtube-noapi

    [fix] youtube_noapi engine

``` 


-->
**How did you install Searx?** installed Searx ussing the offcial wiki

**What happened?**
Mojeek is not visible in preference>engines

**How To Reproduce**
It is visible in settings.yml 

I also have run an older version of searx V0.17 there it is working oke

commit f3bfc19a557ef121d370033de6325df2ca835dcd (HEAD -> master, origin/master, origin/HEAD)
Merge: 3c45fb7a 1ea35605
Author: Alexandre Flament <alex@al-f.net>
Date:   Sun Aug 9 19:21:09 2020 +0200

    Merge pull request #2127 from msafadieh/master

    [fix] fix the browser autocomplete feature.

I hope this gives a detailed description of the bug
I confirm the problem.

Actually the mojeek has no category (it should be `general`).

If I search for `!mojeek time`, I have this error:
```
ERROR:searx.webapp:search error
Traceback (most recent call last):
  File "/home/alexandre/code/searx/searx/webapp.py", line 595, in search
    result_container = search.search()
  File "/home/alexandre/code/searx/searx/search.py", line 536, in search
    results = self.result_container.get_ordered_results()
  File "/home/alexandre/code/searx/searx/results.py", line 355, in get_ordered_results
    self.order_results()
  File "/home/alexandre/code/searx/searx/results.py", line 312, in order_results
    res['category'] = engines[res['engine']].categories[0]
IndexError: list index out of range
```

the category is not set according to:
https://github.com/searx/searx/blob/c1a97322687546a066dacffb472d87a86eaadbd4/searx/settings.yml#L956-L968

But it should not be a problem, since the defaults are:
https://github.com/searx/searx/blob/c1a97322687546a066dacffb472d87a86eaadbd4/searx/engines/__init__.py#L44-L57

Perhaps related to this commit: https://github.com/searx/searx/commit/3786920df975b11c0feb7d8564eb19b634d32977



Resolving patch:
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py
--- a/searx/engines/xpath.py
+++ b/searx/engines/xpath.py
@@ -7,7 +7,6 @@
 content_xpath = None
 title_xpath = None
 thumbnail_xpath = False
-categories = []
 paging = False
 suggestion_xpath = ''
 results_xpath = ''
@@ -39,7 +38,7 @@ def request(query, params):
 def response(resp):
     results = []
     dom = html.fromstring(resp.text)
-    is_onion = True if 'onions' in categories else False
+    is_onion = True if 'onions' in categories else False  # pylint: disable=undefined-variable
 
     if results_xpath:
         for result in eval_xpath_list(dom, results_xpath):
diff --git a/searx/results.py b/searx/results.py
--- a/searx/results.py
+++ b/searx/results.py
@@ -309,10 +309,11 @@ def order_results(self):
 
         for res in results:
             # FIXME : handle more than one category per engine
-            res['category'] = engines[res['engine']].categories[0]
+            engine = engines[res['engine']]
+            res['category'] = engine.categories[0] if len(engine.categories) > 0 else ''
 
             # FIXME : handle more than one category per engine
-            category = engines[res['engine']].categories[0]\
+            category = res['category']\
                 + ':' + res.get('template', '')\
                 + ':' + ('img_src' if 'img_src' in res or 'thumbnail' in res else '')
 


Test patch: