summaryrefslogtreecommitdiff
path: root/searx/query.py
AgeCommit message (Collapse)Author
2024-03-11[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTIONMarkus Heiser
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>
2023-09-19[feat] implement feeling lucky featureBnyro
2023-03-24[mod] replace searx.languages by searx.sxng_localesMarkus Heiser
With the language and region tags from the EngineTraitsMap the handling of SearXNG's tags of languages and regions has been normalized and is no longer a *mystery*. The "languages" became "locales" that are supported by babel and by this, the update_engine_traits.py can be simplified a lot. Other code places can be simplified as well, but these simplifications should (respectively can) only be done when none of the engines work with the deprecated EngineTraits.supported_languages interface anymore. This commit replaces searx.languages by searx.sxng_locales and fix the naming of some names from "language" to "locale" (e.g. language_codes --> sxng_locales). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-02-17Add "Auto-detected" as a language.Alexandre Flament
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.
2022-09-27[fix] typos / reported by @kianmeng in searx PR-3366Markus Heiser
[PR-3366] https://github.com/searx/searx/pull/3366 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-03-19[mod] add flags to the languages filterMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-06[fix] remove broken ? search operatorMartin Fischer
The ? search operator has been broken for some time and currently only raises the question why it's still there. ## Context ## The query "Paris !images" searches for "Paris" in the "images" category. Once upon a time Searx supported "Paris ?images" to search for "Paris" in the currently enabled categories and the "images" category. The feature makes sense ... the ? syntax does not. We will hopefully introduce a +!images syntax in the future. Fixes #702.
2022-01-03[fix] bang syntax for categories with spacesMartin Fischer
2021-12-27[format.python] initial formatting of the python codeMarkus Heiser
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>
2021-10-26[enh] reduce the available language listAlexandre Flament
close #406 settings['search']['languages'] contains the languages codes and 'all'
2021-03-01[enh] autocomplete refactoring, autocomplete on external bangsAlexandre Flament
2021-01-09fix empty colon in query from selecting ChineseMarc Abonce Seguin
2020-12-18[mod] searx.search.EngineRef: remove from_bang parameterAlexandre Flament
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.
2020-12-01[mod] pylint: numerous minor code fixesAlexandre Flament
2020-10-26[fix] resolve query_parts regressionAdam Tauber
2020-10-25[enh] allow searx query parts anywhere in the query - closes #831Adam Tauber
2020-10-01[mod] preferences.py: check language setting with a regex instead of ↵Alexandre Flament
match_language
2020-09-22[mod] add searx.search.EngineRefAlexandre Flament
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.
2020-09-22[mod] add searx/webadapter.pyAlexandre Flament
* move searx.search.get_search_query_from_webapp to searx.webadapter * move searx.query.SearchQuery to searx.search
2020-09-22[mod] searx.query.RawTextQuery: getSearchQuery and changeSearchQuery rename ↵Alexandre Flament
to getQuery and changeQuery getSearchQuery is confusing, the method returns a str not a SearchQuery object
2020-09-12[mod] searx.RawTextQuery: the constructor call parse_queryAlexandre Flament
2020-09-10Drop Python 2 (4/n): SearchQuery.query is a str instead of bytesDalf
2020-09-10Drop Python 2 (3/n): objectsDalf
2020-09-10Drop Python 2 (1/n): remove unicode string and url_utilsDalf
2020-07-03Created new plugin type custom_results. Added new plugin bang_redirect (#2027)Lukas van den Berk
* Made first attempt at the bangs redirects plugin. * It redirects. But in a messy way via javascript. * First version with custom plugin * Added a help page and a operator to see all the bangs available. * Changed to .format because of support * Changed to .format because of support * Removed : in params * Fixed path to json file and changed bang operator * Changed bang operator back to & * Made first attempt at the bangs redirects plugin. * It redirects. But in a messy way via javascript. * First version with custom plugin * Added a help page and a operator to see all the bangs available. * Changed to .format because of support * Changed to .format because of support * Removed : in params * Fixed path to json file and changed bang operator * Changed bang operator back to & * Refactored getting search query. Also changed bang operator to ! and is now working. * Removed prints * Removed temporary bangs_redirect.js file. Updated plugin documentation * Added unit test for the bangs plugin * Fixed a unit test and added 2 more for bangs plugin * Changed back to default settings.yml * Added myself to AUTHORS.rst * Refacored working of custom plugin. * Refactored _get_bangs_data from list to dict to improve search speed. * Decoupled bangs plugin from webserver with redirect_url * Refactored bangs unit tests * Fixed unit test bangs. Removed dubbel parsing in bangs.py * Removed a dumb print statement * Refactored bangs plugin to core engine. * Removed bangs plugin. * Refactored external bangs unit tests from plugin to core. * Removed custom_results/bangs documentation from plugins.rst * Added newline in settings.yml so the PR stays clean. * Changed searx/plugins/__init__.py back to the old file * Removed newline search.py * Refactored get_external_bang_operator from utils to external_bang.py * Removed unnecessary import form test_plugins.py * Removed _parseExternalBang and _isExternalBang from query.py * Removed get_external_bang_operator since it was not necessary * Simplified external_bang.py * Simplified external_bang.py * Moved external_bangs unit tests to test_webapp.py. Fixed return in search with external_bang * Refactored query parsing to unicode to support python2 * Refactored query parsing to unicode to support python2 * Refactored bangs plugin to core engine. * Refactored search parameter to search_query in external_bang.py
2020-02-08[enh] introduce private enginesNoémi Ványi
This PR adds a new setting to engines named `tokens`. It expects a list of tokens which lets searx validate if the request should be accepted or not.
2019-10-14[fix] normalize time range parameterAdam Tauber
2019-08-02[enh] Add timeout limit per request (#1640)Alexandre Flament
The new url parameter "timeout_limit" set timeout limit defined in second. Example "timeout_limit=1.5" means the timeout limit is 1.5 seconds. In addition, the query can start with <[number] to set the timeout limit. For number between 0 and 99, the unit is the second : Example: "<30 searx" means the timeout limit is 3 seconds For number above 100, the unit is the millisecond: Example: "<850 searx" means the timeout is 850 milliseconds. In addition, there is a new optional setting: outgoing.max_request_timeout. If not set, the user timeout can't go above searx configuration (as before: the max timeout of selected engine for a query). If the value is set, the user can set a timeout between 0 and max_request_timeout using <[number] or timeout_limit query parameter. Related to #1077 Updated version of PR #1413 from @isj-privacore
2019-07-17Suggestions: use RawTextQuery to make the suggestions URLs. Update all ↵Dalf
themes accordingly.
2019-03-28[fix] stop engine from sending duplicated requestsMarc Abonce Seguin
2018-04-05Merge pull request #1252 from MarcAbonce/search-languagesAdam Tauber
[mod] Refactor engine's search language handling
2018-03-28[fix] assign the correct variable in query.py - fixes #1253Adam Tauber
2018-03-27refactor engine's search language handlingMarc Abonce Seguin
Add match_language function in utils to match any user given language code with a list of engine's supported languages. Also add language_aliases dict on each engine to translate standard language codes into the custom codes used by the engine.
2018-03-22forward category to engine without highlighting on the uiNoémi Ványi
2017-12-06remove 'all' option from search languagesmarc
2017-11-23[fix] autocompleter py3 compatibility - fixes #1088Zeph
2017-11-23[fix] replace obsolete string.join functionAdam Tauber
2017-05-15[enh] py3 compatibilityAdam Tauber
2017-03-18make search language handling less strictmarc
languages.py can change, so users may query on a language that is not on the list anymore, even if it is still recognized by a few engines. also made no and nb the same because they seem to return the same, though most engines will only support one or the other.
2017-01-12[fix] searching for "!google_images text" doesn't work (bang with underscore)Alexandre Flament
2016-12-29change language list to only include languages with a minimum of enginesmarc
that support them. users can still query lesser supported through the :lang_code bang.
2016-12-13[enh] add supported_languages on engines and auto-generate languages.pymarc
2016-11-02Clean up the architecturedalf
Purposes : - isolate the plugins calls - distinction between parsing the web request and running the search (Search class). To be able to test code easily, to run searx code outside a web server, to filter the search query parameters with plugins more easily, etc... Details : - request.request_data contains request.form or request.args (initialize inside pre_request() function) - Query class is renamed RawTextQuery - SearchQuery class defines all search parameters - get_search_query_from_webapp create a SearchQuery instance (basically the previous Search.__init__ code) - Search class and SearchWithPlugins class takes a SearchQuery instance as class constructor parameter - SearchWithPlugins class inherites from Search class, and run plugins - A dedicated function search_with_plugins executes plugins to have a well define locals() (which is used by the plugins code). - All plugins code is executed inside the try...except block (webapp.py, index function) - advanced_search HTTP parameter value stays in webapp.py (it is only part of UI) - multiple calls to result_container.get_ordered_results() doesn't compute the order multiple time (note : this method was call only once before) - paging value is stored in the result_container class (compute in the extend method) - test about engine.suspend_end_time is done during search method call (instead of __init__) - check that the format parameter value is one of these : html, rss, json, rss (before the html value was assumed but some text formatting wasn't not done)
2016-04-09rename blocked engines to diabled enginesNoemi Vanyi
2015-02-03[enh] category specific engine deactivation - closes #205Adam Tauber
2015-01-31[enh] allow override of blocked engines from query stringAdam Tauber
2015-01-12Merge pull request #166 from Cqoicebordel/non-exclusif-bangAdam Tauber
Add non exclusif bang
2015-01-10[enh] add autocompletion for searx-specific stringsThomas Pointhuber
2015-01-03Add non exclusif bangCqoicebordel
Allow to perform a search while adding an engine (or a category) without adding it "officially" to the request. '?' is used to add an engine without modifying anything else to the request. For example, you can perform a search in the 'general' category, and if you add '?tw' the result from Twitter will be added to the originals results.
2014-10-19[fix] pep8 part II.Adam Tauber