Repository: searx/searx

Issue:
searx.webadapter and utils/standalone_searx.py issues
<!-- PLEASE FILL THESE FIELDS, IT REALLY HELPS THE MAINTAINERS OF SEARX -->

**Version of Searx, commit number if you are using on master branch and stipulate if you forked Searx**
<!-- If you are running on master branch using git execute this command
in order to fetch the latest commit ID:
```
git log -1
``` 
If you are using searx-docker then look at the bottom of the Searx page
and check for the version after "Powered by searx"

Please also stipulate if you are using a forked version of Searx and
include a link to the fork source code.
--> 
Master branch, latest commit id: 6c01145, not using forked version
```
commit 6c0114567e7ba1b3f4a54327eddf658b7474ca58 (HEAD -> master, origin/master, origin/HEAD)
Merge: 5d5ecdb7 b2093a8b
Author: Noémi Ványi <kvch@users.noreply.github.com>
Date:   Sun Apr 11 14:46:59 2021 +0200

    Merge pull request #2744 from ColonisationCaptain/patch-1
    
    Correct typo/grammatical mistake in documentation
```
**How did you install Searx?**
<!-- Did you install Searx using the official wiki or using searx-docker
or manually by executing the searx/webapp.py file? -->

Installed using the official wiki: [Step by step installation](https://searx.github.io/searx/admin/installation-searx.html#step-by-step-installation). However, I want to use a standalone search, so I don't switch to the 'searx' user to run the program. I stayed in my personal user and ran the following in bash:

```
$ mkdir ~/standalone_searx
$ cd ~/standalone_searx
$ git clone https://github.com/searx/searx.git
$ cd searx/
$ conda activate dev_python3
$ python3 searx_extra/standalone_searx.py rain
```
Output (first bug):
```
Traceback (most recent call last):
  File "searx_extra/standalone_searx.py", line 88, in <module>
    import searx.webadapter
ModuleNotFoundError: No module named 'searx.webadapter'
```
Tried another option, a example from the [standalone_searx.py](https://github.com/searx/searx/blob/master/searx_extra/standalone_searx.py) file:
```
$ ipython
In [1]: import importlib
import json
import sys
import searx.engines
import searx.search
search_query = 'rain'
# initialize engines
searx.search.initialize()
# load engines categories once instead of each time the function called
engine_cs = list(searx.engines.categories.keys())
# load module
spec = importlib.util.spec_from_file_location(
    'utils.standalone_searx', 'utils/standalone_searx.py')
sas = importlib.util.module_from_spec(spec)
spec.loader.exec_module(sas)
# use function from module
prog_args = sas.parse_argument([search_query], category_choices=engine_cs)
search_q = sas.get_search_query(prog_args, engine_categories=engine_cs)
res_dict = sas.to_dict(search_q)
sys.stdout.write(json.dumps(
    res_dict, sort_keys=True, indent=4, ensure_ascii=False,
    default=sas.json_serial))
```
Output (second bug):
```
---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-2-151e19fdf7af> in <module>
      7     'utils.standalone_searx', 'utils/standalone_searx.py')
      8 sas = importlib.util.module_from_spec(spec)
----> 9 spec.loader.exec_module(sas)

~/anaconda3/envs/tfg/lib/python3.8/importlib/_bootstrap_external.py in exec_module(self, module)

~/anaconda3/envs/tfg/lib/python3.8/importlib/_bootstrap_external.py in get_code(self, fullname)

~/anaconda3/envs/tfg/lib/python3.8/importlib/_bootstrap_external.py in get_data(self, path)

FileNotFoundError: [Errno 2] No such file or directory: 'utils/standalone_searx.py'
```

**What happened?**
<!-- A clear and concise description of what the bug is. -->
**Bug 1:** I got the `ModuleNotFoundError: No module named 'searx.webadapter'`. I don't know the reason and couldn't fix it so I tried another option (read after first bug output).

**Bug 2:** I got the `FileNotFoundError: [Errno 2] No such file or directory: 'utils/standalone_searx.py'`. The reason is that the _standalone_searx.py_ file is currently located in _search_extra/_, not _utils/_. I suppose that the directory was ~~renamed~~ _moved_ from _utils_ to _search_extra_ and @dalf forgot to change the line 34 from `'utils.standalone_searx', 'utils/standalone_searx.py')` to `'utils.standalone_searx', 'searx_extra/standalone_searx.py')` in the commit b8cd326. This fix works for me.

**How To Reproduce**
<!-- How can we reproduce this issue? (as minimally and as precisely as possible) -->
Follow the instructions specified in _How did you install Searx?_.

**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
I expect the program not to throw the error for the first bug. The second bug is easy to fix, but I don't know the reason of the first one.

**Screenshots & Logs**
<!-- If applicable, add screenshots, logs to help explain your problem. -->
N/A

**Additional context**
<!-- Add any other context about the problem here. -->
N/A

**Remediation**

**Bug 2:** Change the line 34 from `'utils.standalone_searx', 'utils/standalone_searx.py')` to `'utils.standalone_searx', 'searx_extra/standalone_searx.py')` for the [standalone_searx.py](https://github.com/searx/searx/blob/master/searx_extra/standalone_searx.py) file.

I would like to finish saying thanks to all the developers for building this amazing app, not only the members of Searx but also devs like @dalf for the contributions. This is one of the first issues I write so please tell me if you find something inappropriate or any suggestions for me to improve.



Discussion:
Would you mind opening a PR for fixing the second bug?

Resolving patch:
diff --git a/searx_extra/standalone_searx.py b/searx_extra/standalone_searx.py
--- a/searx_extra/standalone_searx.py
+++ b/searx_extra/standalone_searx.py
@@ -31,7 +31,7 @@
 ... engine_cs = list(searx.engines.categories.keys())
 ... # load module
 ... spec = importlib.util.spec_from_file_location(
-...     'utils.standalone_searx', 'utils/standalone_searx.py')
+...     'utils.standalone_searx', 'searx_extra/standalone_searx.py')
 ... sas = importlib.util.module_from_spec(spec)
 ... spec.loader.exec_module(sas)
 ... # use function from module


Test patch: