Engines are loaded into global name `searx.engines.engines` other applications
such as statistics or the histogram use this global variable to search for
values in their own memories, which can lead to key errors as described in
- https://github.com/searxng/searxng/issues/2988
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Closes: https://github.com/searxng/searxng/issues/2988
HTTP GET vs POST
================
Already diskussed in "Method POST harms UX without providing a tangible privacy
benefit" [1]. At that time we agreed to POST. However, as we are having more
and more drawbacks with POST, I suggest that we reconsider our previous
decision. The latest cause was [2], but we also have other problems that
negatively affect the UI [1]:
* Open Link in New Tab: does not work for our search result tabs because they
aren't actual links.
* Bookmarking: a search becomes more difficult with POST. You cannot just press
a browser keyboard shortcut `Ctrl+D` ... no you have to copy the Search URL from
the sidebar. This can pose a real struggle for less technically-minded users.
* Sharing: a search with somebody else becomes more difficult with POST (for
the same reason).
Lock HTTP method in the preferences
===================================
If the user changes the HTTP method in his settings, e.g. from GET to POST, but
has not removed the SearXNG instance from the WEB browser and added it again,
the WEB browser will continue to work with the old setting (GET), while entries
in the HTML form use the newly set method (POST). Not realted to this commit,
but this complication is also known from autocomplete[3].
Only very few maintainers are aware of this fact and probably none of the users
know about it. We should provide a setup in our defaults that is manageable in
its entirety and comprehensible for the user. For this reason, the option to
select the HTTP method in the preferences is also disabled in this commit.
[1] https://github.com/searxng/searxng/issues/711
[2] https://github.com/searxng/searxng/issues/3590
[3] https://github.com/searxng/searxng/pull/2333#issuecomment-1565392120
Closes: https://github.com/searxng/searxng/issues/3590
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Depending on the order in which the unit tests are executed, the python modules
of the engines are initialized (monkey patched) or not. As the order of the
tests is not static, random errors may occur.
To avaoid random `NameError: name 'logger' is not defined` in the unit tests of
the xpath engine, a logger is monkey patched into the xpath py-module.
```
make test.unit
TEST tests/unit
......EE...................
======================================================================
ERROR: test_response (tests.unit.engines.test_xpath.TestXpathEngine.test_response)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./tests/unit/engines/test_xpath.py", line 60, in test_response
self.assertEqual(xpath.response(response), [])
^^^^^^^^^^^^^^^^^^^^^^^^
File "./searx/engines/xpath.py", line 309, in response
logger.debug("found %s results", len(results))
^^^^^^
NameError: name 'logger' is not defined
======================================================================
ERROR: test_response_results_xpath (tests.unit.engines.test_xpath.TestXpathEngine.test_response_results_xpath)
----------------------------------------------------------------------
Traceback (most recent call last):
File "./tests/unit/engines/test_xpath.py", line 102, in test_response_results_xpath
self.assertEqual(xpath.response(response), [])
^^^^^^^^^^^^^^^^^^^^^^^^
File "./searx/engines/xpath.py", line 309, in response
logger.debug("found %s results", len(results))
^^^^^^
NameError: name 'logger' is not defined
```
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
The domains of zlibrary instances are known to be seized from time to time.
This leads to problems when, for example, the automated tasks try to update the
engine traits (aka fetch_traits). The search function should also generate a
suitable error message (currently either SSL errors or empty result lists are
returned). [1]
[1] https://github.com/searxng/searxng/issues/3610
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Fix installing answerers when installing SearXNG through a wheel [1]. These
files have been missed in commit d72fa99b.
Here is what have been tested:
$ make clean py.build
...
$ python -m venv test123
$ . ./test123/bin/activate
(test123) $ pip install dist/searxng-2024*-py3-none-any.whl
(test123) $ SEARXNG_DEBUG=1 searxng-run
[1] https://github.com/searxng/searxng/pull/3045#issuecomment-1961767861
This change does the following things:
- the `ip` keyword is now case-insensitive
- if the query includes `my ip` it will now also match
In order to avoid too many false matches, the `ip` keyword alone matches only if
it's the _only_ word, but the inclusion of `my` loosens that to be inclusive of
users type a phrase (eg, "what is my ip", "tell me my ip", "my IP address",
etc).
Better answer context
Previously this plugin simply dumped your IP or user-agent string as an answer.
This tiny change just adds some text to contextualize those answers (eg, "Your
IP is: 1.2.3.4" instead of just "1.2.3.4").