on master help sign in
161 files changed+38417−8708
since splitsnapshots
unifiedsplit
.github/workflows/data-update.yml+2−2 .github/workflows/integration.yml+32−3 .gitignore+2 .pylintrc+1−1 AUTHORS.rst+1 Dockerfile+5−4 README.rst+2−2 docs/admin/buildhosts.rst+4−4 docs/admin/installation-docker.rst+1−1 docs/admin/installation.rst+6−1 docs/admin/settings.rst+51−13 docs/admin/update-searx.rst+46−10 docs/blog/index.rst+5−3 docs/blog/lxcdev-202006.rst+3−3 docs/blog/search-database-engines.rst+95 docs/blog/sql-engines.rst+117 docs/build-templates/morty.rst+1−1 docs/conf.py+2−1 docs/dev/contribution_guide.rst+11−22 docs/dev/engine_overview.rst+1−1 docs/dev/makefile.rst+116−112 docs/dev/reST.rst+6−7 docs/utils/index.rst+3−3 docs/utils/lxc.sh.rst+3−3 manage+8−5 requirements-dev.txt+14−12 requirements.txt+14−10 searx/autocomplete.py+28−10 searx/data/__init__.py+39−14 searx/data/ahmia_blacklist.txt+11140 searx/data/currencies.json+303−334 searx/data/engines_languages.json+197−497 searx/data/external_bangs.json+5826−5825 searx/data/osm_keys_tags.json+15416 searx/data/useragents.json+4−3 searx/data/wikidata_units.json+129−20 searx/engines/__init__.py+6−6 searx/engines/ahmia.py+2−2 searx/engines/bandcamp.py+73 searx/engines/command.py+1−1 searx/engines/core.py+82 searx/engines/dictzone.py+1−1 searx/engines/duckduckgo.py+97−48 searx/engines/duckduckgo_images.py+1−1 searx/engines/elasticsearch.py+1−2 searx/engines/gigablast.py+25−14 searx/engines/google.py+81−54 searx/engines/google_images.py+6−7 searx/engines/google_news.py+6−7 searx/engines/google_scholar.py+4−5 searx/engines/google_videos.py+5−6 searx/engines/imdb.py+55 searx/engines/invidious.py+2−2 searx/engines/meilisearch.py+1−1 searx/engines/mongodb.py+61 searx/engines/mysql_server.py+62 searx/engines/not_evil.py−67 searx/engines/onesearch.py+57 searx/engines/openstreetmap.py+397−67 searx/engines/postgresql.py+69 searx/engines/prowlarr.py+80 searx/engines/pubmed.py+1−1 searx/engines/qwant.py+184−78 searx/engines/redis_server.py+69 searx/engines/rumble.py+1−1 searx/engines/seznam.py+5−6 searx/engines/sjp.py+92 searx/engines/solidtorrents.py+1−1 searx/engines/soundcloud.py+1−1 searx/engines/spotify.py+3−2 searx/engines/springer.py+74 searx/engines/sqlite.py+51 searx/engines/stackexchange.py+67 searx/engines/stackoverflow.py−65 searx/engines/startpage.py+100−20 searx/engines/tineye.py+86 searx/engines/wikidata.py+1−1 searx/engines/wikipedia.py+1−1 searx/engines/wolframalpha_noapi.py+1−1 searx/engines/wordnik.py+1−1 searx/engines/xpath.py+3−1 searx/engines/xpath_flex.py+121 searx/engines/yacy.py+2−2 searx/engines/yahoo.py+93−91 searx/engines/yggtorrent.py+3−3 searx/engines/youtube_noapi.py+2 searx/external_urls.py+14−2 searx/metrology/error_recorder.py+9−9 searx/network/__init__.py+188 searx/network/client.py+219 searx/network/network.py+358 searx/raise_for_httperror.py → searx/network/raise_for_httperror.py searx/plugins/__init__.py+2 searx/plugins/hostname_replace.py+28 searx/plugins/self_info.py+1−1 searx/plugins/tracker_url_remover.py+1−1 searx/poolrequests.py−235 searx/preferences.py+7−7 searx/results.py+20−6 searx/search/__init__.py+5−2 searx/search/checker/impl.py+6−6 searx/search/processors/online.py+23−26 searx/settings.yml+447−57 searx/settings_loader.py+2−2 searx/settings_robot.yml+8−2 searx/static/themes/simple/js/searx_src/searx_imageresult.js → searx/static/themes/__common__/js/image_layout.js+61−49 searx/static/themes/oscar/css/logicodev-dark.css+29−2 searx/static/themes/oscar/css/logicodev-dark.min.css+1−1 searx/static/themes/oscar/css/logicodev-dark.min.css.map+1−1 searx/static/themes/oscar/css/logicodev.css+29−2 searx/static/themes/oscar/css/logicodev.min.css+1−1 searx/static/themes/oscar/css/logicodev.min.css.map+1−1 searx/static/themes/oscar/gruntfile.js+2−2 searx/static/themes/oscar/img/icons/bandcamp.png searx/static/themes/oscar/js/searx.js+172−83 searx/static/themes/oscar/js/searx.min.js+2−2 searx/static/themes/oscar/js/searx.min.js.map+1−1 searx/static/themes/oscar/src/js/01_init.js+3 searx/static/themes/oscar/src/js/element_modifiers.js+6 searx/static/themes/oscar/src/js/leaflet_map.js−83 searx/static/themes/oscar/src/less/logicodev/results.less+59−2 searx/static/themes/oscar/src/less/logicodev/search.less+2 searx/static/themes/simple/css/searx-rtl.css+1−1 searx/static/themes/simple/css/searx-rtl.min.css+1−1 searx/static/themes/simple/css/searx.css+1−1 searx/static/themes/simple/css/searx.min.css+1−1 searx/static/themes/simple/gruntfile.js+2−2 searx/static/themes/simple/js/searx.head.min.js+1−1 searx/static/themes/simple/js/searx.js+164−239 searx/static/themes/simple/js/searx.min.js+5−4 searx/static/themes/simple/js/searx.min.js.map+1−1 searx/static/themes/simple/js/searx_src/searx_mapresult.js−87 searx/static/themes/simple/js/searx_src/searx_results.js+1−1 searx/static/themes/simple/less/style.less+32 searx/templates/oscar/base.html+1−1 searx/templates/oscar/preferences.html+1−1 searx/templates/oscar/result_templates/default.html+2−2 searx/templates/oscar/result_templates/key-value.html+2−2 searx/templates/oscar/result_templates/map.html+52−48 searx/templates/oscar/result_templates/products.html+2−1 searx/templates/simple/result_templates/map.html+35−52 searx/testing.py+3−3 searx/utils.py+13−7 searx/webadapter.py+1−1 searx/webapp.py+125−48 searx_extra/standalone_searx.py+1−1 searx_extra/update/update_engine_descriptions.py+3−3 searx_extra/update/update_external_bangs.py+4−4 searx_extra/update/update_osm_keys_tags.py+209 tests/unit/network/__init__.py tests/unit/network/test_network.py+239 tests/unit/test_engines_init.py+1−1 tests/unit/test_external_bangs.py−6 tests/unit/test_poolrequests.py−89 tests/unit/test_query.py+10−5 tests/unit/test_results.py+4−4 tests/unit/test_utils.py+2−2 tests/unit/test_webapp.py+12−3 utils/filtron.sh+2−2 utils/lib.sh+2−2 utils/searx.sh+1−1
.github/workflows/data-update.yml+2−2
@@ -29,7 +29,7 @@ jobs:
2929 - name: Set up Python
3030 uses: actions/setup-python@v2
3131 with:
32− python-version: '3.9'
32+ python-version: '3.10'
3333 architecture: 'x64'
3434
3535 - name: Install Python dependencies
@@ -40,7 +40,7 @@ jobs:
4040 env:
4141 FETCH_SCRIPT: ./searx_extra/update/${{ matrix.fetch }}
4242 run: |
43− V=1 manage pyenv.cmd python "$FETCH_SCRIPT"
43+ V=1 ./manage pyenv.cmd python "$FETCH_SCRIPT"
4444
4545 - name: Create Pull Request
4646 id: cpr
.github/workflows/integration.yml+32−3
@@ -13,7 +13,7 @@ jobs:
1313 strategy:
1414 matrix:
1515 os: [ubuntu-20.04]
16− python-version: [3.6, 3.7, 3.8, 3.9]
16+ python-version: [3.7, 3.8, 3.9, "3.10"]
1717 steps:
1818 - name: Checkout
1919 uses: actions/checkout@v2
@@ -56,6 +56,17 @@ jobs:
5656 uses: actions/checkout@v2
5757 - name: Install Ubuntu packages
5858 run: sudo ./utils/searx.sh install packages
59+ - name: Set up Python
60+ uses: actions/setup-python@v2
61+ with:
62+ python-version: '3.9'
63+ architecture: 'x64'
64+ - name: Cache Python dependencies
65+ id: cache-python
66+ uses: actions/cache@v2
67+ with:
68+ path: ./local
69+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
5970 - name: Install node dependencies
6071 run: make V=1 node.env
6172 - name: Build themes
@@ -68,14 +79,21 @@ jobs:
6879 - name: Checkout
6980 uses: actions/checkout@v2
7081 with:
82+ fetch-depth: '0'
7183 persist-credentials: false
7284 - name: Install Ubuntu packages
7385 run: sudo ./utils/searx.sh install buildhost
7486 - name: Set up Python
7587 uses: actions/setup-python@v2
7688 with:
77− python-version: '3.9'
89+ python-version: '3.10'
7890 architecture: 'x64'
91+ - name: Cache Python dependencies
92+ id: cache-python
93+ uses: actions/cache@v2
94+ with:
95+ path: ./local
96+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
7997 - name: Build documentation
8098 run: |
8199 make V=1 docs.clean docs.html
@@ -97,7 +115,7 @@ jobs:
97115 - documentation
98116 env:
99117 DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
100− runs-on: ubuntu-18.04
118+ runs-on: ubuntu-20.04
101119 steps:
102120 - name: Checkout
103121 if: env.DOCKERHUB_USERNAME != null
@@ -105,6 +123,17 @@ jobs:
105123 with:
106124 # make sure "make docker.push" can get the git history
107125 fetch-depth: '0'
126+ - name: Set up Python
127+ uses: actions/setup-python@v2
128+ with:
129+ python-version: '3.9'
130+ architecture: 'x64'
131+ - name: Cache Python dependencies
132+ id: cache-python
133+ uses: actions/cache@v2
134+ with:
135+ path: ./local
136+ key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}
108137 - name: Set up QEMU
109138 if: env.DOCKERHUB_USERNAME != null
110139 uses: docker/setup-qemu-action@v1
.gitignore+2
@@ -26,3 +26,5 @@ dist/
2626local/
2727gh-pages/
2828searx.egg-info/
29+.env
30+geckodriver.log
.pylintrc+1−1
@@ -59,7 +59,7 @@ confidence=
5959# --enable=similarities". If you want to run only the classes checker, but have
6060# no Warning level messages displayed, use"--disable=all --enable=classes
6161# --disable=W"
62−disable=bad-whitespace, duplicate-code
62+disable=bad-whitespace, duplicate-code, consider-using-f-string
6363
6464# Enable the message, report, category or checker with the given id(s). You can
6565# either give multiple identifier separated by comma (,) or put this option
AUTHORS.rst+1
@@ -165,3 +165,4 @@ generally made searx better:
165165- @jhigginbotham
166166- @xenrox
167167- @OliveiraHermogenes
168+- Paul Alcock @Guilvareux
Dockerfile+5−4
@@ -1,4 +1,4 @@
1−FROM alpine:3.12
1+FROM alpine:3.15
22ENTRYPOINT ["/sbin/tini","--","/usr/local/searx/dockerfiles/docker-entrypoint.sh"]
33EXPOSE 8080
44VOLUME /etc/searx
@@ -46,18 +46,19 @@ RUN apk upgrade --no-cache \
4646 uwsgi \
4747 uwsgi-python3 \
4848 brotli \
49− && pip3 install --upgrade pip \
49+ && pip3 install --upgrade pip wheel setuptools \
5050 && pip3 install --no-cache -r requirements.txt \
5151 && apk del build-dependencies \
5252 && rm -rf /root/.cache
5353
54−COPY --chown=searx:searx . .
54+COPY searx ./searx
55+COPY dockerfiles ./dockerfiles
5556
5657ARG TIMESTAMP_SETTINGS=0
5758ARG TIMESTAMP_UWSGI=0
5859ARG VERSION_GITCOMMIT=unknown
5960
60−RUN su searx -c "/usr/bin/python3 -m compileall -q searx"; \
61+RUN /usr/bin/python3 -m compileall -q searx; \
6162 touch -c --date=@${TIMESTAMP_SETTINGS} searx/settings.yml; \
6263 touch -c --date=@${TIMESTAMP_UWSGI} dockerfiles/uwsgi.ini; \
6364 if [ ! -z $VERSION_GITCOMMIT ]; then\
README.rst+2−2
@@ -17,7 +17,7 @@
1717|OpenCollective searx backers|
1818|OpenCollective searx sponsors|
1919
20−Privacy-respecting, hackable `metasearch engine`_ / *pronunciation* **səːks**.
20+Privacy-respecting, hackable `metasearch engine`_ / *pronunciation* **sɜːks**.
2121
2222.. _metasearch engine: https://en.wikipedia.org/wiki/Metasearch_engine
2323
@@ -61,7 +61,7 @@ our homepage_.
6161.. _homepage: https://searx.github.io/searx
6262
6363contact:
64− openhub_ // twitter_ // IRC: #searx @ freenode
64+ openhub_ // twitter_ // IRC: #searx @ Libera (irc.libera.chat)
6565
6666.. _openhub: https://www.openhub.net/p/searx
6767.. _twitter: https://twitter.com/Searx_engine
docs/admin/buildhosts.rst+4−4
@@ -49,9 +49,9 @@ Build docs
4949 - dvisvgm_
5050
5151Most of the sphinx requirements are installed from :origin:`setup.py` and the
52−docs can be build from scratch with ``make docs``. For better math and image
53−processing additional packages are needed. The XeTeX_ needed not only for PDF
54−creation, its also needed for :ref:`math` when HTML output is build.
52+docs can be build from scratch with ``make docs.html``. For better math and
53+image processing additional packages are needed. The XeTeX_ needed not only for
54+PDF creation, its also needed for :ref:`math` when HTML output is build.
5555
5656To be able to do :ref:`sphinx:math-support` without CDNs, the math are rendered
5757as images (``sphinx.ext.imgmath`` extension).
@@ -64,7 +64,7 @@ to ``imgmath``:
6464 :start-after: # sphinx.ext.imgmath setup
6565 :end-before: # sphinx.ext.imgmath setup END
6666
67−If your docs build (``make docs``) shows warnings like this::
67+If your docs build (``make docs.html``) shows warnings like this::
6868
6969 WARNING: dot(1) not found, for better output quality install \
7070 graphviz from https://www.graphviz.org
docs/admin/installation-docker.rst+1−1
@@ -51,7 +51,7 @@ It's also possible to build searx from the embedded Dockerfile.
5151
5252 git clone https://github.com/searx/searx.git
5353 cd searx
54− make docker
54+ make docker.build
5555
5656
5757Public instance
docs/admin/installation.rst+6−1
@@ -39,13 +39,18 @@ install from ``root``, take into account that the scripts are creating a
3939these new created users do need read access to the clone of searx, which is not
4040the case if you clone into a folder below ``/root``.
4141
42−
4342.. code:: bash
4443
4544 $ cd ~/Downloads
4645 $ git clone https://github.com/searx/searx searx
4746 $ cd searx
4847
48+.. sidebar:: further read
49+
50+ - :ref:`toolboxing`
51+ - :ref:`update searx`
52+ - :ref:`inspect searx`
53+
4954**Install** :ref:`searx service <searx.sh>`
5055
5156This installs searx as described in :ref:`installation basic`.
docs/admin/settings.rst+51−13
@@ -130,14 +130,12 @@ Global Settings
130130 request_timeout : 2.0 # default timeout in seconds, can be override by engine
131131 # max_request_timeout: 10.0 # the maximum timeout in seconds
132132 useragent_suffix : "" # informations like an email address to the administrator
133− pool_connections : 100 # Number of different hosts
134− pool_maxsize : 10 # Number of simultaneous requests by host
133+ pool_connections : 100 # Maximum number of allowable connections, or None for no limits. The default is 100.
134+ pool_maxsize : 10 # Number of allowable keep-alive connections, or None to always allow. The default is 10.
135+ enable_http2: True # See https://www.python-httpx.org/http2/
135136 # uncomment below section if you want to use a proxy
136137 # proxies:
137− # http:
138− # - http://proxy1:8080
139− # - http://proxy2:8080
140− # https:
138+ # all://:
141139 # - http://proxy1:8080
142140 # - http://proxy2:8080
143141 # uncomment below section only if you have more than one network interface
@@ -145,6 +143,7 @@ Global Settings
145143 # source_ips:
146144 # - 1.1.1.1
147145 # - 1.1.1.2
146+ # - fe80::/126
148147
149148
150149``request_timeout`` :
@@ -157,20 +156,46 @@ Global Settings
157156 Suffix to the user-agent searx uses to send requests to others engines. If an
158157 engine wish to block you, a contact info here may be useful to avoid that.
159158
160−.. _requests proxies: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
161−.. _PySocks: https://pypi.org/project/PySocks/
159+``keepalive_expiry``:
160+ Number of seconds to keep a connection in the pool. By default 5.0 seconds.
161+
162+.. _httpx proxies: https://www.python-httpx.org/advanced/#http-proxying
162163
163164``proxies`` :
164− Define one or more proxies you wish to use, see `requests proxies`_.
165+ Define one or more proxies you wish to use, see `httpx proxies`_.
165166 If there are more than one proxy for one protocol (http, https),
166167 requests to the engines are distributed in a round-robin fashion.
167168
168− - Proxy: `see <https://2.python-requests.org/en/latest/user/advanced/#proxies>`__.
169− - SOCKS proxies are also supported: `see <https://2.python-requests.org/en/latest/user/advanced/#socks>`__
170−
171169``source_ips`` :
172170 If you use multiple network interfaces, define from which IP the requests must
173− be made. This parameter is ignored when ``proxies`` is set.
171+ be made. Example:
172+
173+ * ``0.0.0.0`` any local IPv4 address.
174+ * ``::`` any local IPv6 address.
175+ * ``192.168.0.1``
176+ * ``[ 192.168.0.1, 192.168.0.2 ]`` these two specific IP addresses
177+ * ``fe80::60a2:1691:e5a2:ee1f``
178+ * ``fe80::60a2:1691:e5a2:ee1f/126`` all IP addresses in this network.
179+ * ``[ 192.168.0.1, fe80::/126 ]``
180+
181+``retries`` :
182+ Number of retry in case of an HTTP error.
183+ On each retry, searx uses an different proxy and source ip.
184+
185+``retry_on_http_error`` :
186+ Retry request on some HTTP status code.
187+
188+ Example:
189+
190+ * ``true`` : on HTTP status code between 400 and 599.
191+ * ``403`` : on HTTP status code 403.
192+ * ``[403, 429]``: on HTTP status code 403 and 429.
193+
194+``enable_http2`` :
195+ Enable by default. Set to ``False`` to disable HTTP/2.
196+
197+``max_redirects`` :
198+ 30 by default. Maximum redirect before it is an error.
174199
175200
176201``locales:``
@@ -216,6 +241,13 @@ Engine settings
216241 api_key : 'apikey'
217242 disabled : True
218243 language : en_US
244+ #enable_http: False
245+ #enable_http2: False
246+ #retries: 1
247+ #retry_on_http_error: True # or 403 or [404, 429]
248+ #max_connections: 100
249+ #max_keepalive_connections: 10
250+ #keepalive_expiry: 5.0
219251 #proxies:
220252 # http:
221253 # - http://proxy1:8080
@@ -270,6 +302,12 @@ Engine settings
270302``display_error_messages`` : default ``True``
271303 When an engine returns an error, the message is displayed on the user interface.
272304
305+``network``: optional
306+ Use the network configuration from another engine.
307+ In addition, there are two default networks:
308+ * ``ipv4`` set ``local_addresses`` to ``0.0.0.0`` (use only IPv4 local addresses)
309+ * ``ipv6`` set ``local_addresses`` to ``::`` (use only IPv6 local addresses)
310+
273311.. note::
274312
275313 A few more options are possible, but they are pretty specific to some
docs/admin/update-searx.rst+46−10
@@ -4,20 +4,56 @@
44How to update
55=============
66
7+How to update depends on the :ref:`installation` method. If you have used the
8+:ref:`installation scripts`, use ``update`` command from the scripts.
9+
10+**Update** :ref:`searx service <searx.sh>`
11+
12+.. code:: sh
13+
14+ sudo -H ./utils/searx.sh update searx
15+
16+**Update** :ref:`filtron reverse proxy <filtron.sh>`
17+
718.. code:: sh
819
9− sudo -H -u searx -i
10− (searx)$ git stash
11− (searx)$ git pull origin master
12− (searx)$ git stash apply
13− (searx)$ ./manage.sh update_packages
20+ sudo -H ./utils/filtron.sh update filtron
21+
22+**Update** :ref:`result proxy <morty.sh>`
23+
24+.. code:: bash
25+
26+ sudo -H ./utils/morty.sh update morty
27+
28+.. _inspect searx:
29+
30+======================
31+How to inspect & debug
32+======================
33+
34+.. sidebar:: further read
35+
36+ - :ref:`toolboxing`
37+ - :ref:`Makefile`
38+
39+How to debug depends on the :ref:`installation` method. If you have used the
40+:ref:`installation scripts`, use ``inspect`` command from the scripts.
41+
42+**Inspect** :ref:`searx service <searx.sh>`
43+
44+.. code:: sh
45+
46+ sudo -H ./utils/searx.sh inspect service
47+
48+**Inspect** :ref:`filtron reverse proxy <filtron.sh>`
49+
50+.. code:: sh
1451
15−Restart uwsgi:
52+ sudo -H ./utils/filtron.sh inspect service
1653
17−.. tabs::
54+**Inspect** :ref:`result proxy <morty.sh>`
1855
19− .. group-tab:: Ubuntu / debian
56+.. code:: bash
2057
21− .. code:: sh
58+ sudo -H ./utils/morty.sh inspect service
2259
23− sudo -H systemctl restart uwsgi
docs/blog/index.rst+5−3
@@ -3,13 +3,15 @@ Blog
33====
44
55.. toctree::
6− :maxdepth: 2
7− :caption: Contents
6+ :titlesonly:
7+ :reversed:
88
9− lxcdev-202006
109 python3
1110 admin
1211 intro-offline
1312 private-engines
13+ lxcdev-202006
1414 command-line-engines
1515 search-indexer-engines
16+ sql-engines
17+ search-database-engines
docs/blog/lxcdev-202006.rst+3−3
@@ -31,7 +31,7 @@ might fail in some aspects we should not overlook.
3131
3232 The environment in which we run all our development processes matters!
3333
34−The :ref:`makefile` and the :ref:`make pyenv` encapsulate a lot for us, but they
34+The :ref:`makefile` and the :ref:`make install` encapsulate a lot for us, but they
3535do not have access to all prerequisites. For example, there may have
3636dependencies on packages that are installed on the developer's desktop, but
3737usually are not preinstalled on a server or client system. Another examples
@@ -356,7 +356,7 @@ daily usage:
356356 .. code:: sh
357357
358358 $ sudo -H ./utils/lxc.sh cmd searx-archlinux \
359− make docs
359+ make docs.html
360360
361361.. _blog-lxcdev-202006 abstract:
362362
@@ -407,7 +407,7 @@ To get remarks from the suite of the archlinux container we can use:
407407 ...
408408 [searx-archlinux] INFO: (eth0) filtron: http://10.174.184.156:4004/ http://10.174.184.156/searx
409409 [searx-archlinux] INFO: (eth0) morty: http://10.174.184.156:3000/
410− [searx-archlinux] INFO: (eth0) docs-live: http://10.174.184.156:8080/
410+ [searx-archlinux] INFO: (eth0) docs.live: http://10.174.184.156:8080/
411411 [searx-archlinux] INFO: (eth0) IPv6: http://[fd42:573b:e0b3:e97e:216:3eff:fea5:9b65]
412412 ...
413413
docs/blog/search-database-engines.rstnew file+95
@@ -0,0 +1,95 @@
1+===============================
2+Query more of your NoSQL stores
3+===============================
4+
5+From now on, searx lets you to query your NoSQL data stores:
6+
7+* `Redis`_
8+* `MongoDB`_
9+
10+The reference configuration of the engines are included ``settings.yml`` just commented out,
11+as you have to set various options and install dependencies before using them.
12+
13+By default, the engines use ``key-value`` template for displaying results.
14+If you are not satisfied with the original result layout,
15+you can use your owm template by placing the template under
16+``searx/templates/{theme_name}/result_templates/{template_name}`` and setting
17+``result_template`` attribute to ``{template_name}``.
18+
19+Futhermore, if you do not want to expose these engines on a public instance, you can
20+still add them and limit the access by setting ``tokens`` as described in the `blog post about
21+private engines`_.
22+
23+Configuring searx to use the stores
24+===================================
25+
26+NoSQL data stores are used for storing arbitrary data without first defining their
27+structure.
28+
29+Redis
30+-----
31+
32+Reqired package: ``redis``
33+
34+Redis is a key value based data store usually stored in memory.
35+
36+Select a database to search in and set its index in the option ``db``. You can
37+either look for exact matches or use partial keywords to find what you are looking for
38+by configuring ``exact_match_only``.
39+
40+In this example you can search for exact matches in your first database:
41+
42+.. code:: yaml
43+
44+ - name : mystore
45+ engine : redis_server
46+ exact_match_only : True
47+ host : 127.0.0.1
48+ port : 6379
49+ password : secret-password
50+ db : 0
51+ shortcut : rds
52+ enable_http : True
53+
54+
55+MongoDB
56+-------
57+
58+Required package: ``pymongo``
59+
60+MongoDB is a document based database program that handles JSON like data.
61+
62+In order to query MongoDB, you have to select a ``database`` and a ``collection``. Furthermore,
63+you have to select a ``key`` that is going to be searched. MongoDB also supports the option ``exact_match_only``, so configure it
64+as you wish.
65+
66+Above is an example configuration for using a MongoDB collection:
67+
68+.. code:: yaml
69+
70+ - name : mymongo
71+ engine : mongodb
72+ shortcut : md
73+ host : '127.0.0.1'
74+ port : 27017
75+ database : personal
76+ collection : income
77+ key : month
78+ enable_http: True
79+
80+
81+Acknowledgement
82+===============
83+
84+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
85+
86+.. _Redis: https://redis.io/
87+.. _MongoDB: https://mongodb.com/
88+.. _blog post about private engines: private-engines.html#private-engines
89+.. _Search and Discovery Fund: https://nlnet.nl/discovery
90+.. _NLnet Foundation: https://nlnet.nl/
91+
92+
93+| Happy hacking.
94+| kvch // 2021.07.13 23:16
95+
docs/blog/sql-engines.rstnew file+117
@@ -0,0 +1,117 @@
1+=================
2+Query SQL servers
3+=================
4+
5+Now you can query SQL servers using searx. The following ones are supported:
6+
7+* `PostgreSQL`_
8+* `MySQL`_
9+* `SQLite`_
10+
11+All of the engines above are added to ``settings.yml`` just commented out, as you have to
12+set the required attributes for the engines, e.g. ``database``. By default, the engines use
13+``key-value`` template for displaying results. If you are not satisfied with the original result layout,
14+you can use your owm template by placing the template under
15+``searx/templates/{theme_name}/result_templates/{template_name}`` and setting
16+``result_template`` attribute to ``{template_name}``.
17+
18+As mentioned in previous blog posts, if you do not wish to expose these engines on a
19+public instance, you can still add them and limit the access by setting ``tokens``
20+as described in the `blog post about private engines`_.
21+
22+Configure the engines
23+=====================
24+
25+The configuration of the new database engines are similar. You must put a valid
26+SELECT SQL query in ``query_str``. At the moment you can only bind at most
27+one parameter in your query. By setting the attribute ``limit`` you can
28+define how many results you want from the SQL server. Basically, it
29+is the same as the LIMIT keyword in SQL.
30+
31+Please, do not include LIMIT or OFFSET in your SQL query as the engines
32+rely on these keywords during paging. If you want to configure the number of returned results
33+use the option ``limit``.
34+
35+PostgreSQL
36+----------
37+
38+PostgreSQL is a powerful and robust open source database.
39+
40+Before configuring the PostgreSQL engine, you must install the dependency ``psychopg2``.
41+
42+You can find an example configuration below:
43+
44+.. code:: yaml
45+
46+ - name : postgresql
47+ engine : postgresql
48+ database : my_database
49+ username : searx
50+ password : password
51+ query_str : 'SELECT * from my_table WHERE my_column = %(query)s'
52+ shortcut : psql
53+
54+
55+MySQL
56+-----
57+
58+MySQL is said to be the most popular open source database.
59+
60+Before enabling MySQL engine, you must install the package ``mysql-connector-python``.
61+
62+The authentication plugin is configurable by setting ``auth_plugin`` in the attributes.
63+By default it is set to ``caching_sha2_password``.
64+
65+This is an example configuration for quering a MySQL server:
66+
67+.. code:: yaml
68+
69+ - name : mysql
70+ engine : mysql_server
71+ database : my_database
72+ username : searx
73+ password : password
74+ limit : 5
75+ query_str : 'SELECT * from my_table WHERE my_column=%(query)s'
76+ shortcut : mysql
77+
78+
79+SQLite
80+------
81+
82+SQLite is a small, fast and reliable SQL database engine. It does not require
83+any extra dependency.
84+
85+You can read from your database ``my_database`` using this example configuration:
86+
87+.. code:: yaml
88+
89+ - name : sqlite
90+ engine : sqlite
91+ shortcut: sq
92+ database : my_database
93+ query_str : 'SELECT * FROM my_table WHERE my_column=:query'
94+
95+
96+Next steps
97+==========
98+
99+The next step is to add support for more data stores, e.g. Redis and MongoDB.
100+
101+Acknowledgement
102+===============
103+
104+This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
105+
106+.. _PostgreSQL: https://www.postgresql.org/
107+.. _MySQL: https://www.mysql.com/
108+.. _SQLite: https://www.sqlite.org/index.html
109+.. _blog post about private engines: private-engines.html#private-engines
110+.. _Search and Discovery Fund: https://nlnet.nl/discovery
111+.. _NLnet Foundation: https://nlnet.nl/
112+
113+
114+| Happy hacking.
115+| kvch // 2021.05.23 23:16
116+
117+
docs/build-templates/morty.rst+1−1
@@ -32,7 +32,7 @@
3232 (${SERVICE_USER}) $ mkdir ${SERVICE_HOME}/local
3333 (${SERVICE_USER}) $ wget --progress=bar -O \"${GO_TAR}\" \\
3434 \"${GO_PKG_URL}\"
35− (${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local/go -xzf \"${GO_TAR}\"
35+ (${SERVICE_USER}) $ tar -C ${SERVICE_HOME}/local -xzf \"${GO_TAR}\"
3636 (${SERVICE_USER}) $ which go
3737 ${SERVICE_HOME}/local/go/bin/go
3838
docs/conf.py+2−1
@@ -10,7 +10,7 @@ from searx.version import VERSION_STRING
1010# Project --------------------------------------------------------------
1111
1212project = u'searx'
13−copyright = u'2015-2020, Adam Tauber, Noémi Ványi'
13+copyright = u'2015-2021, Adam Tauber, Noémi Ványi'
1414author = u'Adam Tauber'
1515release, version = VERSION_STRING, VERSION_STRING
1616highlight_language = 'none'
@@ -101,6 +101,7 @@ imgmath_font_size = 14
101101
102102html_theme_options = {"index_sidebar_logo": True}
103103html_context = {"project_links": [] }
104+html_context["project_links"].append(ProjectLink("Blog", "blog/index.html"))
104105if brand.GIT_URL:
105106 html_context["project_links"].append(ProjectLink("Source", brand.GIT_URL))
106107if brand.WIKI_URL:
docs/dev/contribution_guide.rst+11−22
@@ -132,11 +132,11 @@ Here is an example which makes a complete rebuild:
132132
133133.. code:: sh
134134
135− $ make docs-clean docs
135+ $ make docs.clean docs.html
136136 ...
137137 The HTML pages are in dist/docs.
138138
139−.. _make docs-live:
139+.. _make docs.live:
140140
141141live build
142142----------
@@ -144,19 +144,19 @@ live build
144144.. _sphinx-autobuild:
145145 https://github.com/executablebooks/sphinx-autobuild/blob/master/README.md
146146
147−.. sidebar:: docs-clean
147+.. sidebar:: docs.clean
148148
149149 It is recommended to assert a complete rebuild before deploying (use
150− ``docs-clean``).
150+ ``docs.clean``).
151151
152152Live build is like WYSIWYG. If you want to edit the documentation, its
153−recommended to use. The Makefile target ``docs-live`` builds the docs, opens
153+recommended to use. The Makefile target ``docs.live`` builds the docs, opens
154154URL in your favorite browser and rebuilds every time a reST file has been
155155changed.
156156
157157.. code:: sh
158158
159− $ make docs-live
159+ $ make docs.live
160160 ...
161161 The HTML pages are in dist/docs.
162162 ... Serving on http://0.0.0.0:8000
@@ -169,7 +169,7 @@ argument. E.g to find and use a free port, use:
169169
170170.. code:: sh
171171
172− $ SPHINXOPTS="--port 0" make docs-live
172+ $ SPHINXOPTS="--port 0" make docs.live
173173 ...
174174 ... Serving on http://0.0.0.0:50593
175175 ...
@@ -180,21 +180,10 @@ argument. E.g to find and use a free port, use:
180180deploy on github.io
181181-------------------
182182
183−To deploy documentation at :docs:`github.io <.>` use Makefile target
184−:ref:`make gh-pages`, which will builds the documentation, clones searx into a sub
185−folder ``gh-pages``, cleans it, copies the doc build into and runs all the
186−needed git add, commit and push:
183+To deploy documentation at :docs:`github.io <.>` use Makefile target :ref:`make
184+docs.gh-pages`, which builds the documentation and runs all the needed git add,
185+commit and push:
187186
188187.. code:: sh
189188
190− $ make docs-clean gh-pages
191− ...
192− SPHINX docs --> file://<...>/dist/docs
193− The HTML pages are in dist/docs.
194− ...
195− Cloning into 'gh-pages' ...
196− ...
197− cd gh-pages; git checkout gh-pages >/dev/null
198− Switched to a new branch 'gh-pages'
199− ...
200− doc available at --> https://searx.github.io/searx
189+ $ make docs.clean docs.gh-pages
docs/dev/engine_overview.rst+1−1
@@ -171,7 +171,7 @@ headers set HTTP header information
171171data set HTTP data information
172172cookies set HTTP cookies
173173verify bool Performing SSL-Validity check
174−allow_redirects bool Follow redirects
174+follow_redirects bool Follow redirects
175175max_redirects int maximum redirects, hard limit
176176soft_max_redirects int maximum redirects, soft limit. Record an error but don't stop the engine
177177raise_for_httperror bool True by default: raise an exception if the HTTP code of response is >= 300
docs/dev/makefile.rst+116−112
@@ -1,33 +1,33 @@
11.. _makefile:
22
3−================
4−Makefile Targets
5−================
3+========
4+Makefile
5+========
66
77.. _gnu-make: https://www.gnu.org/software/make/manual/make.html#Introduction
88
99.. sidebar:: build environment
1010
11− Before looking deeper at the targets, first read about :ref:`make pyenv`.
11+ Before looking deeper at the targets, first read about :ref:`make
12+ install`.
1213
1314 To install system requirements follow :ref:`buildhosts`.
1415
15−With the aim to simplify development cycles, started with :pull:`1756` a
16−``Makefile`` based boilerplate was added. If you are not familiar with
17−Makefiles, we recommend to read gnu-make_ introduction.
16+All relevant build tasks are implemented in :origin:`manage.sh` and for CI or
17+IDE integration a small ``Makefile`` wrapper is available. If you are not
18+familiar with Makefiles, we recommend to read gnu-make_ introduction.
1819
1920The usage is simple, just type ``make {target-name}`` to *build* a target.
2021Calling the ``help`` target gives a first overview (``make help``):
2122
2223.. program-output:: bash -c "cd ..; make --no-print-directory help"
2324
24−
2525.. contents:: Contents
2626 :depth: 2
2727 :local:
2828 :backlinks: entry
2929
30−.. _make pyenv:
30+.. _make install:
3131
3232Python environment
3333==================
@@ -36,31 +36,42 @@ Python environment
3636
3737 ``source ./local/py3/bin/activate``
3838
39−With Makefile we do no longer need to build up the virtualenv manually (as
40−described in the :ref:`devquickstart` guide). Jump into your git working tree
41−and release a ``make pyenv``:
42−
43−.. code:: sh
39+We do no longer need to build up the virtualenv manually. Jump into your git
40+working tree and release a ``make install`` to get a virtualenv with a
41+*developer install* of searx (:origin:`setup.py`). ::
4442
4543 $ cd ~/searx-clone
46− $ make pyenv
47− PYENV usage: source ./local/py3/bin/activate
44+ $ make install
45+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
4846 ...
47+ PYENV OK
48+ PYENV [install] pip install -e 'searx[test]'
49+ ...
50+ Successfully installed argparse-1.4.0 searx
51+ BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
52+ BUILDENV INFO:searx:Initialisation done
53+ BUILDENV build utils/brand.env
4954
50−With target ``pyenv`` a development environment (aka virtualenv) was build up in
51−``./local/py3/``. To make a *developer install* of searx (:origin:`setup.py`)
52−into this environment, use make target ``install``:
53−
54−.. code:: sh
55+If you release ``make install`` multiple times the installation will only
56+rebuild if the sha256 sum of the *requirement files* fails. With other words:
57+the check fails if you edit the requirements listed in
58+:origin:`requirements-dev.txt` and :origin:`requirements.txt`). ::
5559
5660 $ make install
57− PYENV usage: source ./local/py3/bin/activate
58− PYENV using virtualenv from ./local/py3
59− PYENV install .
60−
61−You have never to think about intermediate targets like ``pyenv`` or
62−``install``, the ``Makefile`` chains them as requisites. Just run your main
63−target.
61+ PYENV OK
62+ PYENV [virtualenv] requirements.sha256 failed
63+ [virtualenv] - 6cea6eb6def9e14a18bf32f8a3e... ./requirements-dev.txt
64+ [virtualenv] - 471efef6c73558e391c3adb35f4... ./requirements.txt
65+ ...
66+ PYENV [virtualenv] installing ./requirements*.txt into local/py3
67+ ...
68+ PYENV OK
69+ PYENV [install] pip install -e 'searx[test]'
70+ ...
71+ Successfully installed argparse-1.4.0 searx
72+ BUILDENV INFO:searx:load the default settings from ./searx/settings.yml
73+ BUILDENV INFO:searx:Initialisation done
74+ BUILDENV build utils/brand.env
6475
6576.. sidebar:: drop environment
6677
@@ -68,10 +79,7 @@ target.
6879 <make clean>` first.
6980
7081If you think, something goes wrong with your ./local environment or you change
71−the :origin:`setup.py` file (or the requirements listed in
72−:origin:`requirements-dev.txt` and :origin:`requirements.txt`), you have to call
73−:ref:`make clean`.
74−
82+the :origin:`setup.py` file, you have to call :ref:`make clean`.
7583
7684.. _make run:
7785
@@ -81,117 +89,113 @@ the :origin:`setup.py` file (or the requirements listed in
8189To get up a running a developer instance simply call ``make run``. This enables
8290*debug* option in :origin:`searx/settings.yml`, starts a ``./searx/webapp.py``
8391instance, disables *debug* option again and opens the URL in your favorite WEB
84−browser (:man:`xdg-open`):
85−
86−.. code:: sh
92+browser (:man:`xdg-open`)::
8793
88− $ make run
89− PYENV usage: source ./local/py3/bin/activate
90− PYENV install .
91− ./local/py3/bin/python ./searx/webapp.py
92− ...
93− INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
94− ...
94+ $ make run
95+ PYENV OK
96+ SEARX_DEBUG=1 ./manage.sh pyenv.cmd python ./searx/webapp.py
97+ ...
98+ INFO:werkzeug: * Running on http://127.0.0.1:8888/ (Press CTRL+C to quit)
9599
96100.. _make clean:
97101
98102``make clean``
99103==============
100104
101−Drop all intermediate files, all builds, but keep sources untouched. Includes
102−target ``pyclean`` which drops ./local environment. Before calling ``make
103−clean`` stop all processes using :ref:`make pyenv`.
104−
105−.. code:: sh
105+Drop all intermediate files, all builds, but keep sources untouched. Before
106+calling ``make clean`` stop all processes using :ref:`make install`. ::
106107
107108 $ make clean
108− CLEAN pyclean
109− CLEAN clean
109+ CLEAN pyenv
110+ PYENV [virtualenv] drop ./local/py3
111+ CLEAN docs -- ./build/docs ./dist/docs
112+ CLEAN locally installed npm dependencies
113+ CLEAN test stuff
114+ CLEAN common files
110115
111116.. _make docs:
112117
113−``make docs docs-live docs-clean``
114−==================================
118+``make docs docs.autobuild docs.clean``
119+=======================================
115120
116−We describe the usage of the ``doc*`` targets in the :ref:`How to contribute /
121+We describe the usage of the ``doc.*`` targets in the :ref:`How to contribute /
117122Documentation <contrib docs>` section. If you want to edit the documentation
118−read our :ref:`make docs-live` section. If you are working in your own brand,
123+read our :ref:`make docs.live` section. If you are working in your own brand,
119124adjust your :ref:`settings global`.
120125
121−.. _make books:
126+.. _make docs.gh-pages:
122127
123−``make books/{name}.html books/{name}.pdf``
124−===========================================
128+``make docs.gh-pages``
129+======================
125130
126−.. _intersphinx: https://www.sphinx-doc.org/en/stable/ext/intersphinx.html
127−.. _XeTeX: https://tug.org/xetex/
131+To deploy on github.io first adjust your :ref:`settings global`. For any
132+further read :ref:`deploy on github.io`.
128133
129−.. sidebar:: info
134+.. _make test:
130135
131− To build PDF a XeTeX_ is needed, see :ref:`buildhosts`.
136+``make test``
137+=============
132138
139+Runs a series of tests: :ref:`make test.pylint`, ``test.pep8``, ``test.unit``
140+and ``test.robot``. You can run tests selective, e.g.::
133141
134−The ``books/{name}.*`` targets are building *books*. A *book* is a
135−sub-directory containing a ``conf.py`` file. One example is the user handbook
136−which can deployed separately (:origin:`docs/user/conf.py`). Such ``conf.py``
137−do inherit from :origin:`docs/conf.py` and overwrite values to fit *book's*
138−needs.
142+ $ make test.pep8 test.unit test.sh
143+ TEST test.pep8 OK
144+ ...
145+ TEST test.unit OK
146+ ...
147+ TEST test.sh OK
139148
140−With the help of Intersphinx_ (:ref:`reST smart ref`) the links to searx’s
141−documentation outside of the book will be bound by the object inventory of
142−``DOCS_URL``. Take into account that URLs will be picked from the inventary at
143−documentation's build time.
149+.. _make test.sh:
144150
145−Use ``make docs-help`` to see which books available:
151+``make test.sh``
152+================
146153
147−.. program-output:: bash -c "cd ..; make --no-print-directory docs-help"
148− :ellipsis: 0,-6
154+:ref:`sh lint` / if you have changed some bash scripting run this test before
155+commit.
149156
157+.. _make test.pylint:
150158
151−.. _make gh-pages:
159+``make test.pylint``
160+====================
152161
153−``make gh-pages``
154−=================
162+.. _Pylint: https://www.pylint.org/
155163
156−To deploy on github.io first adjust your :ref:`settings global`. For any
157−further read :ref:`deploy on github.io`.
164+Pylint_ is known as one of the best source-code, bug and quality checker for the
165+Python programming language. The pylint profile we use at searx project is
166+found in project's root folder :origin:`.pylintrc`.
158167
159−.. _make test:
168+.. _make search.checker:
160169
161−``make test``
162−=============
170+``search.checker.{engine name}``
171+================================
163172
164−Runs a series of tests: ``test.pep8``, ``test.unit``, ``test.robot`` and does
165−additional :ref:`pylint checks <make pylint>`. You can run tests selective,
166−e.g.:
173+To check all engines::
167174
168−.. code:: sh
175+ make search.checker
169176
170− $ make test.pep8 test.unit test.sh
171− . ./local/py3/bin/activate; ./manage.sh pep8_check
172− [!] Running pep8 check
173− . ./local/py3/bin/activate; ./manage.sh unit_tests
174− [!] Running unit tests
177+To check a engine with whitespace in the name like *google news* replace space
178+by underline::
175179
176−.. _make pylint:
180+ make search.checker.google_news
177181
178−``make pylint``
179−===============
182+To see HTTP requests and more use SEARX_DEBUG::
180183
181−.. _Pylint: https://www.pylint.org/
184+ make SEARX_DEBUG=1 search.checker.google_news
185+
186+.. _3xx: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#3xx_redirection
182187
183−Before commiting its recommend to do some (more) linting. Pylint_ is known as
184−one of the best source-code, bug and quality checker for the Python programming
185−language. Pylint_ is not yet a quality gate within our searx project (like
186−:ref:`test.pep8 <make test>` it is), but Pylint_ can help to improve code
187−quality anyway. The pylint profile we use at searx project is found in
188−project's root folder :origin:`.pylintrc`.
188+To filter out HTTP redirects (3xx_)::
189189
190−Code quality is a ongoing process. Don't try to fix all messages from Pylint,
191−run Pylint and check if your changed lines are bringing up new messages. If so,
192−fix it. By this, code quality gets incremental better and if there comes the
193−day, the linting is balanced out, we might decide to add Pylint as a quality
194−gate.
190+ make SEARX_DEBUG=1 search.checker.google_news | grep -A1 "HTTP/1.1\" 3[0-9][0-9]"
191+ ...
192+ Engine google news Checking
193+ https://news.google.com:443 "GET /search?q=life&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
194+ https://news.google.com:443 "GET /search?q=life&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
195+ --
196+ https://news.google.com:443 "GET /search?q=computer&hl=en&lr=lang_en&ie=utf8&oe=utf8&ceid=US%3Aen&gl=US HTTP/1.1" 302 0
197+ https://news.google.com:443 "GET /search?q=computer&hl=en-US&lr=lang_en&ie=utf8&oe=utf8&ceid=US:en&gl=US HTTP/1.1" 200 None
198+ --
195199
196200
197201``make pybuild``
@@ -200,9 +204,7 @@ gate.
200204.. _PyPi: https://pypi.org/
201205.. _twine: https://twine.readthedocs.io/en/latest/
202206
203−Build Python packages in ``./dist/py``.
204−
205−.. code:: sh
207+Build Python packages in ``./dist/py``::
206208
207209 $ make pybuild
208210 ...
@@ -210,9 +212,11 @@ Build Python packages in ``./dist/py``.
210212 running sdist
211213 running egg_info
212214 ...
213− $ ls ./dist/py/
214− searx-0.15.0-py3-none-any.whl searx-0.15.0.tar.gz
215+ running bdist_wheel
216+
217+ $ ls ./dist
218+ searx-0.18.0-py3-none-any.whl searx-0.18.0.tar.gz
215219
216−To upload packages to PyPi_, there is also a ``upload-pypi`` target. It needs
217−twine_ to be installed. Since you are not the owner of :pypi:`searx` you will
218−never need the latter.
220+To upload packages to PyPi_, there is also a ``pypi.upload`` target (to test use
221+``pypi.upload.test``). Since you are not the owner of :pypi:`searx` you will
222+never need to upload.
docs/dev/reST.rst+6−7
@@ -15,8 +15,8 @@ generated and deployed at :docs:`github.io <.>`. For build prerequisites read
1515:ref:`docs build`.
1616
1717The source files of Searx's documentation are located at :origin:`docs`. Sphinx
18−assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs-live
19−<make docs-live>` to build HTML while editing.
18+assumes source files to be encoded in UTF-8 by defaul. Run :ref:`make docs.live
19+<make docs.live>` to build HTML while editing.
2020
2121.. sidebar:: Further reading
2222
@@ -1276,13 +1276,12 @@ Templating
12761276
12771277.. sidebar:: Build environment
12781278
1279− All *generic-doc* tasks are running in the :ref:`build environment <make
1280− pyenv>`.
1279+ All *generic-doc* tasks are running in the :ref:`make install`.
12811280
12821281Templating is suitable for documentation which is created generic at the build
1283−time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`build
1284−environment <make pyenv>` (with searx modules installed). We use this e.g. to
1285−build chapter: :ref:`engines generic`. Below the jinja directive from the
1282+time. The sphinx-jinja_ extension evaluates jinja_ templates in the :ref:`make
1283+install` (with searx modules installed). We use this e.g. to build chapter:
1284+:ref:`engines generic`. Below the jinja directive from the
12861285:origin:`docs/admin/engines.rst` is shown:
12871286
12881287.. literalinclude:: ../admin/engines.rst
docs/utils/index.rst+3−3
@@ -1,9 +1,9 @@
11.. _searx_utils:
22.. _toolboxing:
33
4−========================================
5−Tooling box ``utils`` for administrators
6−========================================
4+===================
5+Admin's tooling box
6+===================
77
88In the folder :origin:`utils/` we maintain some tools useful for administrators.
99
docs/utils/lxc.sh.rst+3−3
@@ -119,15 +119,15 @@ of coffee).::
119119
120120To build (live) documentation inside a archlinux_ container::
121121
122− sudo -H ./utils/lxc.sh cmd searx-archlinux make docs-clean docs-live
122+ sudo -H ./utils/lxc.sh cmd searx-archlinux make docs.clean docs.live
123123 ...
124124 [I 200331 15:00:42 server:296] Serving on http://0.0.0.0:8080
125125
126126To get IP of the container and the port number *live docs* is listening::
127127
128− $ sudo ./utils/lxc.sh show suite | grep docs-live
128+ $ sudo ./utils/lxc.sh show suite | grep docs.live
129129 ...
130− [searx-archlinux] INFO: (eth0) docs-live: http://n.n.n.12:8080/
130+ [searx-archlinux] INFO: (eth0) docs.live: http://n.n.n.12:8080/
131131
132132
133133.. _lxc.sh help:
manage+8−5
@@ -13,7 +13,7 @@ source_dot_config
1313
1414PY_SETUP_EXTRAS='[test]'
1515NPM_PACKAGES="less@2.7 less-plugin-clean-css grunt-cli"
16−GECKODRIVER_VERSION="v0.28.0"
16+GECKODRIVER_VERSION="v0.30.0"
1717# SPHINXOPTS=
1818
1919# These py files are linted by test.pylint(), all other files are linted by
@@ -32,9 +32,12 @@ PYLINT_FILES=(
3232 searx/engines/meilisearch.py
3333 searx/engines/solidtorrents.py
3434 searx/engines/solr.py
35+ searx/engines/sqlite.py
36+ searx/engines/springer.py
3537 searx/engines/google_scholar.py
3638 searx/engines/yahoo_news.py
3739 searx/engines/apkmirror.py
40+ searx/engines/core.py
3841 searx_extra/update/update_external_bangs.py
3942)
4043
@@ -221,7 +224,7 @@ docker.build() {
221224
222225 # build Docker image
223226 build_msg DOCKER "Building image ${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
224− sudo docker build \
227+ docker build \
225228 --build-arg GIT_URL="${GIT_URL}" \
226229 --build-arg SEARX_GIT_VERSION="${SEARX_GIT_VERSION}" \
227230 --build-arg VERSION_GITCOMMIT="${VERSION_GITCOMMIT}" \
@@ -233,8 +236,8 @@ docker.build() {
233236 -t "${SEARX_IMAGE_NAME}:latest" -t "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}" .
234237
235238 if [ "$1" = "push" ]; then
236− sudo docker push "${SEARX_IMAGE_NAME}:latest"
237− sudo docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
239+ docker push "${SEARX_IMAGE_NAME}:latest"
240+ docker push "${SEARX_IMAGE_NAME}:${SEARX_GIT_VERSION}"
238241 fi
239242 )
240243 dump_return $?
@@ -397,7 +400,7 @@ test.pylint() {
397400 pyenv.cmd python ${PYLINT_OPTIONS} ${PYLINT_VERBOSE} \
398401 --disable="${PYLINT_SEARX_DISABLE_OPTION}" \
399402 --ignore=searx/engines \
400− searx tests
403+ tests
401404 )
402405 dump_return $?
403406}
requirements-dev.txt+14−12
@@ -1,18 +1,20 @@
11mock==4.0.3
22nose2[coverage_plugin]==0.10.0
33cov-core==1.15.0
4−pycodestyle==2.7.0
5−pylint==2.7.4
6−splinter==0.14.0
7−transifex-client==0.14.2
8−selenium==3.141.0
9−twine==3.4.1
10−Pallets-Sphinx-Themes==1.2.3
4+pycodestyle==2.8.0
5+pylint==2.12.2
6+splinter==0.17.0
7+transifex-client==0.14.3; python_version < '3.10'
8+transifex-client==0.12.1; python_version == '3.10'
9+selenium==4.1.0
10+twine==3.7.1
11+Pallets-Sphinx-Themes==2.0.2
1112docutils==0.16
12−Sphinx==3.5.3
13−sphinx-issues==1.2.0
14−sphinx-jinja==1.1.1
15−sphinx-tabs==2.1.0
13+Sphinx==4.4.0
14+sphinx-issues==3.0.1
15+sphinx-jinja==1.4.0
16+sphinx-tabs==3.2.0
1617sphinxcontrib-programoutput==0.17
1718sphinx-autobuild==2021.3.14
18−linuxdoc==20210324
19+linuxdoc==20211220
20+aiounittest==1.4.1
requirements.txt+14−10
@@ -1,12 +1,16 @@
1−certifi==2020.12.05
2−babel==2.9.0
1+certifi==2021.10.8
2+babel==2.9.1
33flask-babel==2.0.0
4−flask==1.1.2
5−idna==2.10
6−jinja2==2.11.3
7−lxml==4.6.3
4+flask==2.0.2
5+jinja2==3.0.3
6+lxml==4.7.1
87pygments==2.8.0
9−python-dateutil==2.8.1
10−pyyaml==5.4.1
11−requests[socks]==2.25.1
12−langdetect==1.0.8
8+python-dateutil==2.8.2
9+pyyaml==6.0
10+httpx[http2]==0.21.3
11+Brotli==1.0.9
12+uvloop==0.16.0; python_version >= '3.7'
13+uvloop==0.14.0; python_version < '3.7'
14+httpx-socks[asyncio]==0.7.2
15+langdetect==1.0.9
16+setproctitle==1.2.2
searx/autocomplete.py+28−10
@@ -20,10 +20,12 @@ from lxml import etree
2020from json import loads
2121from urllib.parse import urlencode
2222
23−from requests import RequestException
23+from httpx import HTTPError
24+
2425
2526from searx import settings
26−from searx.poolrequests import get as http_get
27+from searx.data import ENGINES_LANGUAGES
28+from searx.network import get as http_get
2729from searx.exceptions import SearxEngineResponseException
2830
2931
@@ -34,6 +36,22 @@ def get(*args, **kwargs):
3436 return http_get(*args, **kwargs)
3537
3638
39+def brave(query, lang):
40+ # brave search autocompleter
41+ url = 'https://search.brave.com/api/suggest?{query}'
42+
43+ resp = get(url.format(query=urlencode({'q': query})))
44+
45+ results = []
46+
47+ if resp.ok:
48+ data = loads(resp.text)
49+ for suggestion in data[1]:
50+ results.append(suggestion)
51+
52+ return results
53+
54+
3755def dbpedia(query, lang):
3856 # dbpedia autocompleter, no HTTPS
3957 autocomplete_url = 'https://lookup.dbpedia.org/api/search.asmx/KeywordSearch?'
@@ -76,12 +94,11 @@ def google(query, lang):
7694
7795def startpage(query, lang):
7896 # startpage autocompleter
79− url = 'https://startpage.com/do/suggest?{query}'
80−
81− resp = get(url.format(query=urlencode({'query': query}))).text.split('\n')
82− if len(resp) > 1:
83− return resp
84− return []
97+ lui = ENGINES_LANGUAGES['startpage'].get(lang, 'english')
98+ url = 'https://startpage.com/suggestions?{query}'
99+ resp = get(url.format(query=urlencode({'q': query, 'segment': 'startpage.udog', 'lui': lui})))
100+ data = resp.json()
101+ return [e['text'] for e in data.get('suggestions', []) if 'text' in e]
85102
86103
87104def swisscows(query, lang):
@@ -119,7 +136,8 @@ def wikipedia(query, lang):
119136 return []
120137
121138
122−backends = {'dbpedia': dbpedia,
139+backends = {'brave': brave,
140+ 'dbpedia': dbpedia,
123141 'duckduckgo': duckduckgo,
124142 'google': google,
125143 'startpage': startpage,
@@ -136,5 +154,5 @@ def search_autocomplete(backend_name, query, lang):
136154
137155 try:
138156 return backend(query, lang)
139− except (RequestException, SearxEngineResponseException):
157+ except (HTTPError, SearxEngineResponseException):
140158 return []
searx/data/__init__.py+39−14
@@ -1,25 +1,50 @@
1+# SPDX-License-Identifier: AGPL-3.0-or-later
2+# lint: pylint
3+"""This module holds the *data* created by::
4+
5+ make data.all
6+
7+"""
8+
9+__all__ = [
10+ 'ENGINES_LANGUAGES',
11+ 'CURRENCIES',
12+ 'USER_AGENTS',
13+ 'EXTERNAL_URLS',
14+ 'WIKIDATA_UNITS',
15+ 'EXTERNAL_BANGS',
16+ 'OSM_KEYS_TAGS',
17+ 'ahmia_blacklist_loader',
18+]
19+
120import json
221from pathlib import Path
322
4−
5−__init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS', 'EXTERNAL_BANGS',
6− 'bangs_loader', 'ahmia_blacklist_loader']
723data_dir = Path(__file__).parent
824
925
10−def load(filename):
11− with open(data_dir / filename, encoding='utf-8') as fd:
12− return json.load(fd)
26+def _load(filename):
27+ with open(data_dir / filename, encoding='utf-8') as f:
28+ return json.load(f)
1329
1430
1531def ahmia_blacklist_loader():
16− with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
17− return fd.read().split()
32+ """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
33+ names. The MD5 values are fetched by::
34+
35+ searx_extra/update/update_ahmia_blacklist.py
36+
37+ This function is used by :py:mod:`searx.plugins.ahmia_filter`.
38+
39+ """
40+ with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
41+ return f.read().split()
1842
1943
20−ENGINES_LANGUAGES = load('engines_languages.json')
21−CURRENCIES = load('currencies.json')
22−USER_AGENTS = load('useragents.json')
23−EXTERNAL_URLS = load('external_urls.json')
24−WIKIDATA_UNITS = load('wikidata_units.json')
25−EXTERNAL_BANGS = load('external_bangs.json')
44+ENGINES_LANGUAGES = _load('engines_languages.json')
45+CURRENCIES = _load('currencies.json')
46+USER_AGENTS = _load('useragents.json')
47+EXTERNAL_URLS = _load('external_urls.json')
48+WIKIDATA_UNITS = _load('wikidata_units.json')
49+EXTERNAL_BANGS = _load('external_bangs.json')
50+OSM_KEYS_TAGS = _load('osm_keys_tags.json')
searx/data/ahmia_blacklist.txt+11140

This diff is too big to show here.

searx/data/currencies.json+303−334

This diff is too big to show here.

searx/data/engines_languages.json+197−497

This diff is too big to show here.

searx/data/external_bangs.json+5826−5825

This diff is too big to show here.

searx/data/osm_keys_tags.jsonnew file+15416

This diff is too big to show here.

searx/data/useragents.json+4−3

This diff is too big to show here.

searx/data/wikidata_units.json+129−20

This diff is too big to show here.

searx/engines/__init__.py+6−6

This diff is too big to show here.

searx/engines/ahmia.py+2−2

This diff is too big to show here.

searx/engines/bandcamp.pynew file+73

This diff is too big to show here.

searx/engines/command.py+1−1

This diff is too big to show here.

searx/engines/core.pynew file+82

This diff is too big to show here.

searx/engines/dictzone.py+1−1

This diff is too big to show here.

searx/engines/duckduckgo.py+97−48

This diff is too big to show here.

searx/engines/duckduckgo_images.py+1−1

This diff is too big to show here.

searx/engines/elasticsearch.py+1−2

This diff is too big to show here.

searx/engines/gigablast.py+25−14

This diff is too big to show here.

searx/engines/google.py+81−54

This diff is too big to show here.

searx/engines/google_images.py+6−7

This diff is too big to show here.

searx/engines/google_news.py+6−7

This diff is too big to show here.

searx/engines/google_scholar.py+4−5

This diff is too big to show here.

searx/engines/google_videos.py+5−6

This diff is too big to show here.

searx/engines/imdb.pynew file+55

This diff is too big to show here.

searx/engines/invidious.py+2−2

This diff is too big to show here.

searx/engines/meilisearch.py+1−1

This diff is too big to show here.

searx/engines/mongodb.pynew file+61

This diff is too big to show here.

searx/engines/mysql_server.pynew file+62

This diff is too big to show here.

searx/engines/not_evil.pydeleted−67

This diff is too big to show here.

searx/engines/onesearch.pynew file+57

This diff is too big to show here.

searx/engines/openstreetmap.py+397−67

This diff is too big to show here.

searx/engines/postgresql.pynew file+69

This diff is too big to show here.

searx/engines/prowlarr.pynew file+80

This diff is too big to show here.

searx/engines/pubmed.py+1−1

This diff is too big to show here.

searx/engines/qwant.py+184−78

This diff is too big to show here.

searx/engines/redis_server.pynew file+69

This diff is too big to show here.

searx/engines/rumble.py+1−1

This diff is too big to show here.

searx/engines/seznam.py+5−6

This diff is too big to show here.

searx/engines/sjp.pynew file+92

This diff is too big to show here.

searx/engines/solidtorrents.py+1−1

This diff is too big to show here.

searx/engines/soundcloud.py+1−1

This diff is too big to show here.

searx/engines/spotify.py+3−2

This diff is too big to show here.

searx/engines/springer.pynew file+74

This diff is too big to show here.

searx/engines/sqlite.pynew file+51

This diff is too big to show here.

searx/engines/stackexchange.pynew file+67

This diff is too big to show here.

searx/engines/stackoverflow.pydeleted−65

This diff is too big to show here.

searx/engines/startpage.py+100−20

This diff is too big to show here.

searx/engines/tineye.pynew file+86

This diff is too big to show here.

searx/engines/wikidata.py+1−1

This diff is too big to show here.

searx/engines/wikipedia.py+1−1

This diff is too big to show here.

searx/engines/wolframalpha_noapi.py+1−1

This diff is too big to show here.

searx/engines/wordnik.py+1−1

This diff is too big to show here.

searx/engines/xpath.py+3−1

This diff is too big to show here.

searx/engines/xpath_flex.pynew file+121

This diff is too big to show here.

searx/engines/yacy.py+2−2

This diff is too big to show here.

searx/engines/yahoo.py+93−91

This diff is too big to show here.

searx/engines/yggtorrent.py+3−3

This diff is too big to show here.

searx/engines/youtube_noapi.py+2

This diff is too big to show here.

searx/external_urls.py+14−2

This diff is too big to show here.

searx/metrology/error_recorder.py+9−9

This diff is too big to show here.

searx/network/__init__.pynew file+188

This diff is too big to show here.

searx/network/client.pynew file+219

This diff is too big to show here.

searx/network/network.pynew file+358

This diff is too big to show here.

searx/raise_for_httperror.py → searx/network/raise_for_httperror.pyrenamed

The content is the same.

searx/plugins/__init__.py+2

This diff is too big to show here.

searx/plugins/hostname_replace.pynew file+28

This diff is too big to show here.

searx/plugins/self_info.py+1−1

This diff is too big to show here.

searx/plugins/tracker_url_remover.py+1−1

This diff is too big to show here.

searx/poolrequests.pydeleted−235

This diff is too big to show here.

searx/preferences.py+7−7

This diff is too big to show here.

searx/results.py+20−6

This diff is too big to show here.

searx/search/__init__.py+5−2

This diff is too big to show here.

searx/search/checker/impl.py+6−6

This diff is too big to show here.

searx/search/processors/online.py+23−26

This diff is too big to show here.

searx/settings.yml+447−57

This diff is too big to show here.

searx/settings_loader.py+2−2

This diff is too big to show here.

searx/settings_robot.yml+8−2

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_imageresult.js → searx/static/themes/__common__/js/image_layout.jsrenamed+61−49

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.css+29−2

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.min.css+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev-dark.min.css.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.css+29−2

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.min.css+1−1

This diff is too big to show here.

searx/static/themes/oscar/css/logicodev.min.css.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/gruntfile.js+2−2

This diff is too big to show here.

searx/static/themes/oscar/img/icons/bandcamp.pngnew file

Binary file not shown.

searx/static/themes/oscar/js/searx.js+172−83

This diff is too big to show here.

searx/static/themes/oscar/js/searx.min.js+2−2

This diff is too big to show here.

searx/static/themes/oscar/js/searx.min.js.map+1−1

This diff is too big to show here.

searx/static/themes/oscar/src/js/01_init.js+3

This diff is too big to show here.

searx/static/themes/oscar/src/js/element_modifiers.js+6

This diff is too big to show here.

searx/static/themes/oscar/src/js/leaflet_map.js−83

This diff is too big to show here.

searx/static/themes/oscar/src/less/logicodev/results.less+59−2

This diff is too big to show here.

searx/static/themes/oscar/src/less/logicodev/search.less+2

This diff is too big to show here.

searx/static/themes/simple/css/searx-rtl.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx-rtl.min.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx.css+1−1

This diff is too big to show here.

searx/static/themes/simple/css/searx.min.css+1−1

This diff is too big to show here.

searx/static/themes/simple/gruntfile.js+2−2

This diff is too big to show here.

searx/static/themes/simple/js/searx.head.min.js+1−1

This diff is too big to show here.

searx/static/themes/simple/js/searx.js+164−239

This diff is too big to show here.

searx/static/themes/simple/js/searx.min.js+5−4

This diff is too big to show here.

searx/static/themes/simple/js/searx.min.js.map+1−1

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_mapresult.js−87

This diff is too big to show here.

searx/static/themes/simple/js/searx_src/searx_results.js+1−1

This diff is too big to show here.

searx/static/themes/simple/less/style.less+32

This diff is too big to show here.

searx/templates/oscar/base.html+1−1

This diff is too big to show here.

searx/templates/oscar/preferences.html+1−1

This diff is too big to show here.

searx/templates/oscar/result_templates/default.html+2−2

This diff is too big to show here.

searx/templates/oscar/result_templates/key-value.html+2−2

This diff is too big to show here.

searx/templates/oscar/result_templates/map.html+52−48

This diff is too big to show here.

searx/templates/oscar/result_templates/products.html+2−1

This diff is too big to show here.

searx/templates/simple/result_templates/map.html+35−52

This diff is too big to show here.

searx/testing.py+3−3

This diff is too big to show here.

searx/utils.py+13−7

This diff is too big to show here.

searx/webadapter.py+1−1

This diff is too big to show here.

searx/webapp.py+125−48

This diff is too big to show here.

searx_extra/standalone_searx.py+1−1

This diff is too big to show here.

searx_extra/update/update_engine_descriptions.py+3−3

This diff is too big to show here.

searx_extra/update/update_external_bangs.py+4−4

This diff is too big to show here.

searx_extra/update/update_osm_keys_tags.pynew file+209

This diff is too big to show here.

tests/unit/network/__init__.pynew file

No changes to the content.

tests/unit/network/test_network.pynew file+239

This diff is too big to show here.

tests/unit/test_engines_init.py+1−1

This diff is too big to show here.

tests/unit/test_external_bangs.py−6

This diff is too big to show here.

tests/unit/test_poolrequests.pydeleted−89

This diff is too big to show here.

tests/unit/test_query.py+10−5

This diff is too big to show here.

tests/unit/test_results.py+4−4

This diff is too big to show here.

tests/unit/test_utils.py+2−2

This diff is too big to show here.

tests/unit/test_webapp.py+12−3

This diff is too big to show here.

utils/filtron.sh+2−2

This diff is too big to show here.

utils/lib.sh+2−2

This diff is too big to show here.

utils/searx.sh+1−1

This diff is too big to show here.