Commit Graph

26 Commits (542f7d0d7bd1a12e1884ba4a1508b40e2514d472)

Author SHA1 Message Date
Markus Heiser 542f7d0d7b [mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION
In the past, some files were tested with the standard profile, others with a
profile in which most of the messages were switched off ... some files were not
checked at all.

- ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished
- the distinction ``# lint: pylint`` is no longer necessary
- the pylint tasks have been reduced from three to two

  1. ./searx/engines -> lint engines with additional builtins
  2. ./searx ./searxng_extra ./tests -> lint all other python files

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 months ago
Markus Heiser b5a8ddfec8
Revert "[fix] limit maximum page number of a search query to page 50." (#2979)
This reverts commit 7e2e335dd1.
7 months ago
Markus Heiser 7e2e335dd1 [fix] limit maximum page number of a search query to page 50.
To test this PR run a local instance and try to query page 51:

    http://127.0.0.1:8888/search?q=foo&pageno=51

A parameter exception will be raised:

    searx.exceptions.SearxParameterException: Invalid value "51" for parameter pageno

And the client will receive a HTTP 400 (Bad request).

Closes https://github.com/searxng/searxng/issues/2972

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
7 months ago
Bnyro dcee823345 [feat] implement feeling lucky feature 9 months ago
Markus Heiser d5ecda9930 [mod] move language recognition to get_search_query_from_webapp
To set the language from language recognition and hold the value selected by the
client, the previous implementation creates a copy of the SearchQuery object and
manipulates the SearchQuery object by calling function replace_auto_language().

This patch tries to implement a similar functionality in a more central place,
in function get_search_query_from_webapp() when the SearchQuery object is build
up.

Additional this patch uses the language preferred by the client, if language
recognition does not have a match / the existing implementation does not care
about client preferences and uses 'all' in case of no match.

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
1 year ago
Alexandre Flament 6748e8e2d5 Add "Auto-detected" as a language.
When the user choose "Auto-detected", the choice remains on the following queries.
The detected language is displayed.

For example "Auto-detected (en)":
* the next query language is going to be auto detected
* for the current query, the detected language is English.

This replace the autodetect_search_language plugin.
1 year ago
Markus Heiser ba8959ad7c [fix] typos / reported by @kianmeng in searx PR-3366
[PR-3366] https://github.com/searx/searx/pull/3366

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Alexandre Flament 41ae5aea2b [fix] disabling all engines in a category makes the bang search in general
with this commit, there is no result
2 years ago
Markus Heiser 3d96a9839a [format.python] initial formatting of the python code
This patch was generated by black [1]::

    make format.python

[1] https://github.com/psf/black

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2 years ago
Markus Heiser df351937f4 [fix] typo in searx.webadapter.parse_lang
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
3 years ago
Adam Tauber 44f4a9d49a [enh] add ability to send engine data to subsequent requests 3 years ago
Alexandre Flament 3f8ebf70b1 [fix] pylint: use "raise ... from ..." 3 years ago
Alexandre Flament eda8934f15 [mod] searx.search.EngineRef: remove from_bang parameter
from_bang is True when the user query contains a bang.
In this case the category is also set to 'none'.

from_bang only usage was in searx.webadapter.parse_specific :
if from_bang is True, then the EngineRef category is ignored and force to 'none'.

This commit also removes the searx.webadapter.parse_sepecific function.
4 years ago
Alexandre Flament 995ba2f406 [mod] searx.search.SearchQuery: remove categories parameter
The categories parameter is useless in the constructor:
it is always the categories from the EngineRef.

The categories becomes a property.
4 years ago
Alexandre Flament e28b56e262 [fix] webadapter: fix locked categories 4 years ago
Noémi Ványi 33e139cae6 Let admins lock user preferences 4 years ago
Alexandre Flament d5950079cf [fix] fix searx.webadapter
* Fix "?q=test&engines=wikipedia": fix exception
* Fix "?q=test&engines=wikipedia&categories=images": now the engines from images category are included.
* Fix parse_timeout: make sure a value is always returned
* Various typing fixes (searx.webadapter, searx.search.SearchQuery)
4 years ago
Alexandre Flament 507896c115 [mod] preferences.py: check language setting with a regex instead of match_language 4 years ago
Alexandre Flament f2f3300bde [mod] more typing 4 years ago
Alexandre Flament 485a502b88 [mod] add typing and __slots__ 4 years ago
Alexandre Flament 678699beaf [mod] searx/webadapter.py: add get_selected_categories share common code with get_search_query_from_webapp
Update searx/webapp.py to use get_selected_categories
Close #2142
4 years ago
Alexandre Flament d5b5e48f04 [mod] searx/webadapter.py: each web parameter has a dedicated function (parse_pageno, page_lang,....). 4 years ago
Alexandre Flament 691d12726b [mod] check the engine tokens in searx/webadapter.py instead of searx/search.py 4 years ago
Alexandre Flament eecfff2689 [mod] check time_range parameter in searx/webadapter.py 4 years ago
Alexandre Flament 2929495112 [mod] add searx.search.EngineRef
was previously a Dict with two or three keys: name, category, from_bang
make clear that this is a engine reference (see tests/unit/test_search.py for example)
all variables using this class are renamed accordingly.
4 years ago
Alexandre Flament 2dbc0de0cd [mod] add searx/webadapter.py
* move searx.search.get_search_query_from_webapp to searx.webadapter
* move searx.query.SearchQuery to searx.search
4 years ago