summaryrefslogtreecommitdiff
path: root/searx/results.py
AgeCommit message (Collapse)Author
2024-11-29[enh] use longest title and test get_ordered_results()Allen
2024-08-31[fix] search: titles including html brackets are not shown properlyBnyro
2024-06-07[feat] hostname replace plugin: possibility to prioritize certain websitesBnyro
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
2024-05-24[fix] ResultContainer: use self._lock and self._closed for all propertiesAlexandre Flament
Close #3474
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>
2024-02-06[fix] KeyError: 'title' in results using key-value.html templateMarkus Heiser
Since #2508 a title is required --> this is a bug when an engine uses the key-value.html template [1], where no title is needed. [1] https://github.com/searxng/searxng/blob/master/searx/templates/simple/result_templates/key-value.html Closes: https://github.com/searxng/searxng/issues/3130 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-11-27[mod] Retain page numbers even when there are no resultsobfuscated-loop
2023-06-19[mod] move some code from webapp module to webutils module (no functional ↵Markus Heiser
change) Over the years the webapp module became more and more a mess. To improve the modulaization a little this patch moves some implementations from the webapp module to webutils module. HINT: this patch brings non functional change Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
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-02-26[simple theme] replace Image_layout.js with flexbox CS impl.mrpaulblack
* drop image_layout.js from simple theme * move image_layout.js to oscar theme and delete common js dir (since its empty now) * align top position of image detail modal with bottom position of search header * use flexbox to display images; row height can be set via @results-image-row-height in defenitions.less * display span title underneath each image with a max width of 12rem * increase margin and padding around image article on desktop and tablet * make article height smaller on phone layout (height of 6rem) to display more content on current view * remove content from result, if the title and content matches * use a group that cotains the flex image article, if images are mixed with other categories * fix pylint issues in webapp.py * use the default.html result template in unit tests (thanks @return42)
2022-01-17[typing] add results.UnresponsiveEngineMartin Fischer
2022-01-17[refactor] remove never used parameterMartin Fischer
2022-01-17[typing] add results.TimingMartin 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-11-26[fix] searx.results: fix pylint issue "useless-with-lock"Alexandre Flament
Replace "with threading.Lock():" by "with self._lock"
2021-09-10[fix] searx/results.py: strip result['content'] only if it existsAlexandre Flament
fix PR #302
2021-09-09[mod] plugin: call on_result after each engine from the ResultContainerAlexandre Flament
Currently, searx.search.Search calls on_result once the engine results have been merged (ResultContainer.order_results). on_result plugins can rewrite the results: once the URL(s) are modified, even they can be merged, it won't be the case since ResultContainer.order_results has already be called. This commit call on_result inside for each result of each engines. In addition the on_result function can return False to remove the result. Note: the on_result function now run on the engine thread instead of the Flask thread.
2021-05-22[fix] offline engine: don't crash on time recordingAlexandre Flament
2021-04-21[mod] metrics: add secondary parameterAlexandre Flament
Some error won't stop the engine: * additional HTTP redirects for example * some invalid results secondary=True allows to flag these errors as not important.
2021-04-21[enh] rewrite and enhance metricsAlexandre Flament
2021-04-21[mod] refactoring: processorsAlexandre Flament
Report to the user suspended engines. searx.search.processor.abstract: * manages suspend time (per network). * reports suspended time to the ResultContainer (method extend_container_if_suspended) * adds the results to the ResultContainer (method extend_container) * handles exceptions (method handle_exception)
2021-03-06[enh] add ability to send engine data to subsequent requestsAdam Tauber
2020-12-10[mod] results: don't crash when an engine don't have a categoryAlexandre Flament
According to https://github.com/searx/searx/blob/820b468bfe96f693d60ce06f1e78af51f00deefc/searx/engines/__init__.py#L87-L88 an engine can have no category at all. Without this commit, searx raise an exception in searx/results.py Note: in this case, the engine is not shown in the preferences.
2020-12-03[enh] record details exception per engineAlexandre Flament
add an new API /stats/errors
2020-12-01[mod] pylint: numerous minor code fixesAlexandre Flament
2020-11-14[mod] remove unused importAlexandre Flament
use from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA so it is possible to easily remove all unused import using autoflake: autoflake --in-place --recursive --remove-all-unused-imports searx tests
2020-10-28[mod] result.py: merge infobox URL and attributes when the same label or the ↵Alexandre Flament
same entity entity are wikidata entity (like "Q42" for "Douglas Adams", see https://www.wikidata.org/wiki/Q42 )
2020-09-10Drop Python 2 (3/n): objectsDalf
2020-09-10Drop Python 2 (1/n): remove unicode string and url_utilsDalf
2020-09-08[mod] results.py: code clean up (#2140)Alexandre Flament
2020-08-09add engine's name in infobox's headerMarc Abonce Seguin
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-06-09[enh] add routing directions to osm search - closes #254Adam Tauber
2020-05-31add display_error_messages option to engine settingsNoémi Ványi
A new option is added to engines to hide error messages from users. It is called `display_error_messages` and by default it is set to `True`. If it is set to `False` error messages do not show up on the UI. Keep in mind that engines are still suspended if needed regardless of this setting. Closes #1828
2020-04-17[fix] translate engine errors to Occitan when configuredNoémi Ványi
2019-11-15[mod] speed optimizationDalf
compile XPath only once avoid redundant call to urlparse get_locale(webapp.py): avoid useless call to request.accept_languages.best_match
2019-10-16add initial support for offline engines && command engineNoémi Ványi
2019-07-27[fix] don't merge image results if the img_src is differentDalf
2019-07-17[enh] Add Server-Timing header (#1637)Alexandre Flament
Server Timing specification: https://www.w3.org/TR/server-timing/ In the browser Dev Tools, focus on the main request, there are the responses per engine in the Timing tab.
2017-12-01[fix] skip non-string result url/title/contentAdam Tauber
2017-11-03results: make engines of results setNoémi Ványi
Previously, if a same result was returned from the same engine, the name of the engine would be added more than once. To eliminate engine name duplication engine list was changed to set.
2017-07-26ensure all parameters are merged in resultsmarc
2017-07-20change unresponsive_engines to a set to eliminate duplication of errorsNoémi Ványi
2017-07-12show engine errors in infobox && add new error alertNoémi Ványi
2017-05-22[mod] add category to each results, and change group criterias (template and ↵Alexandre Flament
existing image)
2017-05-15[enh] py3 compatibilityAdam Tauber
2017-01-16[enh] show spelling correctionsDavid A Roberts
2016-12-30[mod] result_container.extend sets result['engine'] = engine_name for each ↵Alexandre Flament
result
2016-11-19[enh] add quick answer functionality with an example answererAdam Tauber
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)