summaryrefslogtreecommitdiff
path: root/searx/autocomplete.py
AgeCommit message (Collapse)Author
2024-07-02[fix] html.unescape stract autocomplete suggestionsAllen
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-01-07[feat] autocompleter: implementation of stract (beta)Bnyro
2023-08-27[doc] add documentation of Mwmbl engine & autocompleterMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-08-27[mod] autocomplete.py: add support for mwmbl completionsBnyro
2023-03-24[mod] remove obsolete EngineTraits.supported_languagesMarkus Heiser
All engines has been migrated from ``supported_languages`` to the ``fetch_traits`` concept. There is no longer a need for the obsolete code that implements the ``supported_languages`` concept. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] Google: reversed engineered & upgrade to data_type: traits_v1Markus Heiser
Partial reverse engineering of the Google engines including a improved language and region handling based on the engine.traits_v1 data. When ever possible the implementations of the Google engines try to make use of the async REST APIs. The get_lang_info() has been generalized to a get_google_info() function / especially the region handling has been improved by adding the cr parameter. searx/data/engine_traits.json Add data type "traits_v1" generated by the fetch_traits() functions from: - Google (WEB), - Google images, - Google news, - Google scholar and - Google videos and remove data from obsolete data type "supported_languages". A traits.custom type that maps region codes to *supported_domains* is fetched from https://www.google.com/supported_domains searx/autocomplete.py: Reversed engineered autocomplete from Google WEB. Supports Google's languages and subdomains. The old API suggestqueries.google.com/complete has been replaced by the async REST API: https://{subdomain}/complete/search?{args} searx/engines/google.py Reverse engineering and extensive testing .. - fetch_traits(): Fetch languages & regions from Google properties. - always use the async REST API (formally known as 'use_mobile_ui') - use *supported_domains* from traits - improved the result list by fetching './/div[@data-content-feature]' and parsing the type of the various *content features* --> thumbnails are added searx/engines/google_images.py Reverse engineering and extensive testing .. - fetch_traits(): Fetch languages & regions from Google properties. - use *supported_domains* from traits - if exists, freshness_date is added to the result - issue 1864: result list has been improved a lot (due to the new cr parameter) searx/engines/google_news.py Reverse engineering and extensive testing .. - fetch_traits(): Fetch languages & regions from Google properties. *supported_domains* is not needed but a ceid list has been added. - different region handling compared to Google WEB - fixed for various languages & regions (due to the new ceid parameter) / avoid CONSENT page - Google News do no longer support time range - result list has been fixed: XPath of pub_date and pub_origin searx/engines/google_videos.py - fetch_traits(): Fetch languages & regions from Google properties. - use *supported_domains* from traits - add paging support - implement a async request ('asearch': 'arc' & 'async': 'use_ac:true,_fmt:html') - simplified code (thanks to '_fmt:html' request) - issue 1359: fixed xpath of video length data searx/engines/google_scholar.py - fetch_traits(): Fetch languages & regions from Google properties. - use *supported_domains* from traits - request(): include patents & citations - response(): fixed CAPTCHA detection (Scholar has its own CATCHA manager) - hardening XPath to iterate over results - fixed XPath of pub_type (has been change from gs_ct1 to gs_cgt2 class) - issue 1769 fixed: new request implementation is no longer incompatible Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] DuckDuckGo: reversed engineered & upgrade to data_type: traits_v1Markus Heiser
Partial reverse engineering of the DuckDuckGo (DDG) engines including a improved language and region handling based on the enigne.traits_v1 data. - DDG Lite - DDG Instant Answer API - DDG Images - DDG Weather docs/src/searx.engine.duckduckgo.rst: Online documentation of the DDG engines (make docs.live) searx/data/engine_traits.json Add data type "traits_v1" generated by the fetch_traits() functions from: - "duckduckgo" (WEB), - "duckduckgo images" and - "duckduckgo weather" and remove data from obsolete data type "supported_languages". searx/autocomplete.py: Reversed engineered Autocomplete from DDG. Supports DDG's languages. searx/engines/duckduckgo.py: - fetch_traits(): Fetch languages & regions from DDG. - get_ddg_lang(): Get DDG's language identifier from SearXNG's locale. DDG defines its languages by region codes. DDG-Lite does not offer a language selection to the user, only a region can be selected by the user. - Cache ``vqd`` value: The vqd value depends on the query string and is needed for the follow up pages or the images loaded by a XMLHttpRequest (DDG images). The ``vqd`` value of a search term is stored for 10min in the redis DB. - DDG Lite engine: reversed engineered request method with improved Language and region support and better ``vqd`` handling. searx/engines/duckduckgo_definitions.py: DDG Instant Answer API The *instant answers* API does not support languages, or at least we could not find out how language support should work. It seems that most of the features are based on English terms. searx/engines/duckduckgo_images.py: DDG Images Reversed engineered request method. Improved language and region handling based on cookies and the enigne.traits_v1 data. Response: add image format to the result list searx/engines/duckduckgo_weather.py: DDG Weather Improved language and region handling based on cookies and the enigne.traits_v1 data. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] Startpage: reversed engineered & upgrade to data_type: traits_v1Markus Heiser
One reason for the often seen CAPTCHA of the Startpage requests are the incomplete requests SearXNG sends to startpage.com: this patch is a complete new implementation of the ``request()`` function, reversed engineered from the Startpage's search form. The new implementation: - use traits of data_type: traits_v1 and drop deprecated data_type: supported_languages - adds time-range support - adds save-search support - fix searxng/searxng/issues 1884 - fix searxng/searxng/issues 1081 --> improvements to avoid CAPTCHA In preparation for more categories (News, Images, Videos ..) from Startpage, the variable ``startpage_categ`` was set up. The default value is ``web`` and other categories from Startpage are not yet implemented. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] wikipedia & wikidata: upgrade to data_type: traits_v1Markus Heiser
BTW this fix an issue in wikipedia: SearXNG's locales zh-TW and zh-HK are now using language `zh-classical` from wikipedia (and not `zh`). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] qwant: fetch engine traits (data_type: traits_v1)Markus Heiser
Implements a fetch_traits function for the Qwant engines. .. note:: Includes migration of the request methode from 'supported_languages' to 'traits' (EngineTraits) object! Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-03-24[mod] replace engines_languages.json by engines_traits.jsonMarkus Heiser
Implementations of the *traits* of the engines. Engine's traits are fetched from the origin engine and stored in a JSON file in the *data folder*. Most often traits are languages and region codes and their mapping from SearXNG's representation to the representation in the origin search engine. To load traits from the persistence:: searx.enginelib.traits.EngineTraitsMap.from_data() For new traits new properties can be added to the class:: searx.enginelib.traits.EngineTraits .. hint:: Implementation is downward compatible to the deprecated *supported_languages method* from the vintage implementation. The vintage code is tagged as *deprecated* an can be removed when all engines has been ported to the *traits method*. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2023-02-10[mod] make python code pylint 2.16.1 compliantMarkus Heiser
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-09-17remove the print statementLencoDigitexer
2022-09-09add yandex autocompleterLencoDigitexer
2022-05-07[format.python] based on bugfix in 9ed626130Markus Heiser
2022-04-14[enh] add seznam autocompleteVojtěch Fošnár
2022-01-23[fix] brave autocompleter: charset_normalizer issuesMarkus Heiser
Use httpx.Response.json() to avoid charset_normalizer issues: DEBUG charset_normalizer : override steps (5) and chunk_size (512) as content does not fit (153 byte(s) given) parameters. INFO charset_normalizer : ascii passed initial chaos probing. Mean measured chaos is 0.000000 % DEBUG charset_normalizer : ascii should target any language(s) of ['Latin Based'] INFO charset_normalizer : ascii is most likely the one. Stopping the process. [1] https://www.python-httpx.org/api/#response Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-23[pylint] searx/autocomplete.pyMarkus Heiser
Fix remarks from pylint, BTW set SPDX-License-Identifier. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2022-01-21[enh] Add autocompleter from BraveAllen
Raw response example: https://search.brave.com/api/suggest?q=how%20to:%20with%20j Headers are needed in order to get a 200 response, thus Searx user-agent is used. Other URL param could be '&rich=false' or '&rich=true'. Cherry-pick: https://github.com/allendema/searx/commit/71786bf9cb6fbb175a054692e6951e77769aac1b
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-13[fix] startpage autocompletionAlexandre Flament
2021-04-12[httpx] replace searx.poolrequests by searx.networkAlexandre Flament
settings.yml: * outgoing.networks: * can contains network definition * propertiers: enable_http, verify, http2, max_connections, max_keepalive_connections, keepalive_expiry, local_addresses, support_ipv4, support_ipv6, proxies, max_redirects, retries * retries: 0 by default, number of times searx retries to send the HTTP request (using different IP & proxy each time) * local_addresses can be "192.168.0.1/24" (it supports IPv6) * support_ipv4 & support_ipv6: both True by default see https://github.com/searx/searx/pull/1034 * each engine can define a "network" section: * either a full network description * either reference an existing network * all HTTP requests of engine use the same HTTP configuration (it was not the case before, see proxy configuration in master)
2021-04-10[enh] replace requests by httpxAlexandre Flament
2021-03-01[enh] autocomplete refactoring, autocomplete on external bangsAlexandre Flament
2020-12-04[fix] dbpedia autocomplete (and use HTTPS)Alexandre Flament
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-10Drop Python 2 (1/n): remove unicode string and url_utilsDalf
2020-02-14Add Swisscows autocomplete optionpiplongrun
2019-07-01[fix] never pass bangs to autocomplete suggestionsMarc Abonce Seguin
2017-07-10[fix] use py2/3 compatibility layerAdam Tauber
2017-05-15[enh] py3 compatibilityAdam Tauber
2017-01-03[fix] autocomplete unicode issue - closes #808Adam Tauber
2016-12-13[enh] add supported_languages on engines and auto-generate languages.pymarc
2016-03-29[enh] multilingual autocompletea01200356
implemented for wikipedia, qwant and google
2016-03-02[enh] autocompletion : add qwantAlexandre Flament
2016-01-18[fix] pep8 compatibiltyAdam Tauber
2015-08-02[mod] change settings file structure according to #314Adam Tauber
2015-06-02remove 'print'Dalf
2015-06-01Add startpage as an autocompleter engineCqoicebordel
2015-05-02Merge pull request #308 from dalf/versions_upgradeAdam Tauber
update versions.cfg to use the current up-to-date packages
2015-05-02update versions.cfg to use the current up-to-date packagesAlexandre Flament
2015-05-02[enh] reduce the number of http outgoing connections.Alexandre Flament
engines that still use http : gigablast, bing image for thumbnails, 1x and dbpedia autocompleter
2015-04-10[fix] timeout to autocompletersAdam Tauber
2015-01-21Merge pull request #192 from dalf/connection-poolAdam Tauber
[enh] improve response time. close #100
2015-01-21[enh] use one single http connection pool : improve response time. close #100dalf
2015-01-19Thanks @pointhi !Cqoicebordel
2015-01-19Add '?' bang to the autocompleterCqoicebordel
2015-01-10[fix] little autocompleter fixThomas Pointhuber
2015-01-10[enh] add autocompletion for searx-specific stringsThomas Pointhuber