mirror of https://github.com/searxng/searxng.git
Compare commits
5 Commits
567ad94310
...
ea75302e27
Author | SHA1 | Date |
---|---|---|
Allen | ea75302e27 | |
dependabot[bot] | 4b57bc3db1 | |
searxng-bot | a345cbbe51 | |
Markus Heiser | 21dd524a12 | |
Allen | 0476de443e |
|
@ -1,7 +1,7 @@
|
||||||
certifi==2024.8.30
|
certifi==2024.8.30
|
||||||
babel==2.16.0
|
babel==2.16.0
|
||||||
flask-babel==4.0.0
|
flask-babel==4.0.0
|
||||||
flask==3.0.3
|
flask==3.1.0
|
||||||
jinja2==3.1.4
|
jinja2==3.1.4
|
||||||
lxml==5.3.0
|
lxml==5.3.0
|
||||||
pygments==2.18.0
|
pygments==2.18.0
|
||||||
|
|
|
@ -12,7 +12,6 @@ from searx import logger
|
||||||
from searx.engines import engines
|
from searx.engines import engines
|
||||||
from searx.metrics import histogram_observe, counter_add, count_error
|
from searx.metrics import histogram_observe, counter_add, count_error
|
||||||
|
|
||||||
|
|
||||||
CONTENT_LEN_IGNORED_CHARS_REGEX = re.compile(r'[,;:!?\./\\\\ ()-_]', re.M | re.U)
|
CONTENT_LEN_IGNORED_CHARS_REGEX = re.compile(r'[,;:!?\./\\\\ ()-_]', re.M | re.U)
|
||||||
WHITESPACE_REGEX = re.compile('( |\t|\n)+', re.M | re.U)
|
WHITESPACE_REGEX = re.compile('( |\t|\n)+', re.M | re.U)
|
||||||
|
|
||||||
|
@ -133,7 +132,7 @@ def result_score(result, priority):
|
||||||
weight = 1.0
|
weight = 1.0
|
||||||
|
|
||||||
for result_engine in result['engines']:
|
for result_engine in result['engines']:
|
||||||
if hasattr(engines[result_engine], 'weight'):
|
if hasattr(engines.get(result_engine), 'weight'):
|
||||||
weight *= float(engines[result_engine].weight)
|
weight *= float(engines[result_engine].weight)
|
||||||
|
|
||||||
weight *= len(result['positions'])
|
weight *= len(result['positions'])
|
||||||
|
@ -332,10 +331,14 @@ class ResultContainer:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __merge_duplicated_http_result(self, duplicated, result, position):
|
def __merge_duplicated_http_result(self, duplicated, result, position):
|
||||||
# using content with more text
|
# use content with more text
|
||||||
if result_content_len(result.get('content', '')) > result_content_len(duplicated.get('content', '')):
|
if result_content_len(result.get('content', '')) > result_content_len(duplicated.get('content', '')):
|
||||||
duplicated['content'] = result['content']
|
duplicated['content'] = result['content']
|
||||||
|
|
||||||
|
# use title with more text
|
||||||
|
if result_content_len(result.get('title', '')) > len(duplicated.get('title', '')):
|
||||||
|
duplicated['title'] = result['title']
|
||||||
|
|
||||||
# merge all result's parameters not found in duplicate
|
# merge all result's parameters not found in duplicate
|
||||||
for key in result.keys():
|
for key in result.keys():
|
||||||
if not duplicated.get(key):
|
if not duplicated.get(key):
|
||||||
|
@ -347,7 +350,7 @@ class ResultContainer:
|
||||||
# add engine to list of result-engines
|
# add engine to list of result-engines
|
||||||
duplicated['engines'].add(result['engine'])
|
duplicated['engines'].add(result['engine'])
|
||||||
|
|
||||||
# using https if possible
|
# use https if possible
|
||||||
if duplicated['parsed_url'].scheme != 'https' and result['parsed_url'].scheme == 'https':
|
if duplicated['parsed_url'].scheme != 'https' and result['parsed_url'].scheme == 'https':
|
||||||
duplicated['url'] = result['parsed_url'].geturl()
|
duplicated['url'] = result['parsed_url'].geturl()
|
||||||
duplicated['parsed_url'] = result['parsed_url']
|
duplicated['parsed_url'] = result['parsed_url']
|
||||||
|
|
Binary file not shown.
|
@ -39,7 +39,7 @@ msgstr ""
|
||||||
"Project-Id-Version: searx\n"
|
"Project-Id-Version: searx\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||||
"PO-Revision-Date: 2024-11-03 09:08+0000\n"
|
"PO-Revision-Date: 2024-11-14 14:07+0000\n"
|
||||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
||||||
"Language-Team: Spanish <https://translate.codeberg.org/projects/searxng/"
|
"Language-Team: Spanish <https://translate.codeberg.org/projects/searxng/"
|
||||||
"searxng/es/>\n"
|
"searxng/es/>\n"
|
||||||
|
@ -1249,7 +1249,7 @@ msgstr "Buscador de favicon"
|
||||||
|
|
||||||
#: searx/templates/simple/preferences/favicon.html:15
|
#: searx/templates/simple/preferences/favicon.html:15
|
||||||
msgid "Display favicons near search results"
|
msgid "Display favicons near search results"
|
||||||
msgstr ""
|
msgstr "Mostrar los favicons al lado de los resultados de búsqueda"
|
||||||
|
|
||||||
#: searx/templates/simple/preferences/footer.html:2
|
#: searx/templates/simple/preferences/footer.html:2
|
||||||
msgid ""
|
msgid ""
|
||||||
|
|
Binary file not shown.
|
@ -28,13 +28,14 @@
|
||||||
# unoyoa <unoyoa@users.noreply.translate.codeberg.org>, 2024.
|
# unoyoa <unoyoa@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# tiziodcaio <tiziodcaio@users.noreply.translate.codeberg.org>, 2024.
|
# tiziodcaio <tiziodcaio@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# Fabio_Perri <Fabio_Perri@users.noreply.translate.codeberg.org>, 2024.
|
# Fabio_Perri <Fabio_Perri@users.noreply.translate.codeberg.org>, 2024.
|
||||||
|
# lrnz2 <lrnz2@users.noreply.translate.codeberg.org>, 2024.
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: searx\n"
|
"Project-Id-Version: searx\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||||
"PO-Revision-Date: 2024-10-08 13:41+0000\n"
|
"PO-Revision-Date: 2024-11-14 02:16+0000\n"
|
||||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
"Last-Translator: lrnz2 <lrnz2@users.noreply.translate.codeberg.org>\n"
|
||||||
"Language-Team: Italian <https://translate.codeberg.org/projects/searxng/"
|
"Language-Team: Italian <https://translate.codeberg.org/projects/searxng/"
|
||||||
"searxng/it/>\n"
|
"searxng/it/>\n"
|
||||||
"Language: it\n"
|
"Language: it\n"
|
||||||
|
@ -42,13 +43,13 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=utf-8\n"
|
"Content-Type: text/plain; charset=utf-8\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||||
"X-Generator: Weblate 5.7.2\n"
|
"X-Generator: Weblate 5.8.1\n"
|
||||||
"Generated-By: Babel 2.16.0\n"
|
"Generated-By: Babel 2.16.0\n"
|
||||||
|
|
||||||
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
#. CONSTANT_NAMES['NO_SUBGROUPING']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "without further subgrouping"
|
msgid "without further subgrouping"
|
||||||
msgstr "senza altri sottogruppi"
|
msgstr "senza altri sottogruppamenti"
|
||||||
|
|
||||||
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
|
#. CONSTANT_NAMES['DEFAULT_CATEGORY']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -73,7 +74,7 @@ msgstr "musica"
|
||||||
#. CATEGORY_NAMES['SOCIAL_MEDIA']
|
#. CATEGORY_NAMES['SOCIAL_MEDIA']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "social media"
|
msgid "social media"
|
||||||
msgstr "social"
|
msgstr "social media"
|
||||||
|
|
||||||
#. CATEGORY_NAMES['IMAGES']
|
#. CATEGORY_NAMES['IMAGES']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -113,7 +114,7 @@ msgstr "mappa"
|
||||||
#. CATEGORY_NAMES['ONIONS']
|
#. CATEGORY_NAMES['ONIONS']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "onions"
|
msgid "onions"
|
||||||
msgstr "onion"
|
msgstr "cipolle"
|
||||||
|
|
||||||
#. CATEGORY_NAMES['SCIENCE']
|
#. CATEGORY_NAMES['SCIENCE']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -133,7 +134,7 @@ msgstr "dizionari"
|
||||||
#. CATEGORY_GROUPS['LYRICS']
|
#. CATEGORY_GROUPS['LYRICS']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "lyrics"
|
msgid "lyrics"
|
||||||
msgstr "testi musicali"
|
msgstr "testo musicale"
|
||||||
|
|
||||||
#. CATEGORY_GROUPS['PACKAGES']
|
#. CATEGORY_GROUPS['PACKAGES']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -148,12 +149,12 @@ msgstr "d&r"
|
||||||
#. CATEGORY_GROUPS['REPOS']
|
#. CATEGORY_GROUPS['REPOS']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "repos"
|
msgid "repos"
|
||||||
msgstr "ripostigli"
|
msgstr "repos"
|
||||||
|
|
||||||
#. CATEGORY_GROUPS['SOFTWARE_WIKIS']
|
#. CATEGORY_GROUPS['SOFTWARE_WIKIS']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "software wikis"
|
msgid "software wikis"
|
||||||
msgstr "wiki software"
|
msgstr "wiki del software"
|
||||||
|
|
||||||
#. CATEGORY_GROUPS['WEB']
|
#. CATEGORY_GROUPS['WEB']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -193,7 +194,7 @@ msgstr "Tempo di attività"
|
||||||
#. BRAND_CUSTOM_LINKS['ABOUT']
|
#. BRAND_CUSTOM_LINKS['ABOUT']
|
||||||
#: searx/searxng.msg searx/templates/simple/base.html:50
|
#: searx/searxng.msg searx/templates/simple/base.html:50
|
||||||
msgid "About"
|
msgid "About"
|
||||||
msgstr "A proposito"
|
msgstr "Al riguardo"
|
||||||
|
|
||||||
#. WEATHER_TERMS['AVERAGE TEMP.']
|
#. WEATHER_TERMS['AVERAGE TEMP.']
|
||||||
#: searx/engines/wttr.py:32 searx/searxng.msg
|
#: searx/engines/wttr.py:32 searx/searxng.msg
|
||||||
|
|
Binary file not shown.
|
@ -11,13 +11,14 @@
|
||||||
# omfj <omfj@users.noreply.translate.codeberg.org>, 2024.
|
# omfj <omfj@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# combwizard <combwizard@users.noreply.translate.codeberg.org>, 2024.
|
# combwizard <combwizard@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# laaknor <laaknor@users.noreply.translate.codeberg.org>, 2024.
|
# laaknor <laaknor@users.noreply.translate.codeberg.org>, 2024.
|
||||||
|
# Aadniz <Aadniz@users.noreply.translate.codeberg.org>, 2024.
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PROJECT VERSION\n"
|
"Project-Id-Version: PROJECT VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||||
"PO-Revision-Date: 2024-11-03 09:08+0000\n"
|
"PO-Revision-Date: 2024-11-09 12:07+0000\n"
|
||||||
"Last-Translator: laaknor <laaknor@users.noreply.translate.codeberg.org>\n"
|
"Last-Translator: Aadniz <Aadniz@users.noreply.translate.codeberg.org>\n"
|
||||||
"Language-Team: Norwegian Bokmål <https://translate.codeberg.org/projects/"
|
"Language-Team: Norwegian Bokmål <https://translate.codeberg.org/projects/"
|
||||||
"searxng/searxng/nb_NO/>\n"
|
"searxng/searxng/nb_NO/>\n"
|
||||||
"Language: nb_NO\n"
|
"Language: nb_NO\n"
|
||||||
|
@ -192,13 +193,13 @@ msgstr "Skydekke"
|
||||||
#: searx/engines/duckduckgo_weather.py:45 searx/engines/wttr.py:51
|
#: searx/engines/duckduckgo_weather.py:45 searx/engines/wttr.py:51
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Condition"
|
msgid "Condition"
|
||||||
msgstr ""
|
msgstr "Betingelse"
|
||||||
|
|
||||||
#. WEATHER_TERMS['CURRENT CONDITION']
|
#. WEATHER_TERMS['CURRENT CONDITION']
|
||||||
#: searx/engines/duckduckgo_weather.py:118 searx/engines/wttr.py:104
|
#: searx/engines/duckduckgo_weather.py:118 searx/engines/wttr.py:104
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Current condition"
|
msgid "Current condition"
|
||||||
msgstr ""
|
msgstr "Nåværende betingelse"
|
||||||
|
|
||||||
#. WEATHER_TERMS['EVENING']
|
#. WEATHER_TERMS['EVENING']
|
||||||
#: searx/engines/wttr.py:100 searx/searxng.msg
|
#: searx/engines/wttr.py:100 searx/searxng.msg
|
||||||
|
@ -221,13 +222,13 @@ msgstr "Luftfuktighet"
|
||||||
#: searx/engines/duckduckgo_weather.py:77 searx/engines/wttr.py:34
|
#: searx/engines/duckduckgo_weather.py:77 searx/engines/wttr.py:34
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Max temp."
|
msgid "Max temp."
|
||||||
msgstr ""
|
msgstr "Maks temp."
|
||||||
|
|
||||||
#. WEATHER_TERMS['MIN TEMP.']
|
#. WEATHER_TERMS['MIN TEMP.']
|
||||||
#: searx/engines/duckduckgo_weather.py:73 searx/engines/wttr.py:33
|
#: searx/engines/duckduckgo_weather.py:73 searx/engines/wttr.py:33
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Min temp."
|
msgid "Min temp."
|
||||||
msgstr ""
|
msgstr "Min temp."
|
||||||
|
|
||||||
#. WEATHER_TERMS['MORNING']
|
#. WEATHER_TERMS['MORNING']
|
||||||
#: searx/engines/wttr.py:100 searx/searxng.msg
|
#: searx/engines/wttr.py:100 searx/searxng.msg
|
||||||
|
@ -334,17 +335,17 @@ msgstr "opphavsmann"
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD OPEN']
|
#. SOCIAL_MEDIA_TERMS['THREAD OPEN']
|
||||||
#: searx/engines/discourse.py:149 searx/searxng.msg
|
#: searx/engines/discourse.py:149 searx/searxng.msg
|
||||||
msgid "open"
|
msgid "open"
|
||||||
msgstr ""
|
msgstr "åpen"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD CLOSED']
|
#. SOCIAL_MEDIA_TERMS['THREAD CLOSED']
|
||||||
#: searx/engines/discourse.py:149 searx/searxng.msg
|
#: searx/engines/discourse.py:149 searx/searxng.msg
|
||||||
msgid "closed"
|
msgid "closed"
|
||||||
msgstr ""
|
msgstr "lukket"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD ANSWERED']
|
#. SOCIAL_MEDIA_TERMS['THREAD ANSWERED']
|
||||||
#: searx/engines/discourse.py:160 searx/searxng.msg
|
#: searx/engines/discourse.py:160 searx/searxng.msg
|
||||||
msgid "answered"
|
msgid "answered"
|
||||||
msgstr ""
|
msgstr "svart på"
|
||||||
|
|
||||||
#: searx/webapp.py:332
|
#: searx/webapp.py:332
|
||||||
msgid "No item found"
|
msgid "No item found"
|
||||||
|
@ -421,7 +422,7 @@ msgstr "tilgang nektet"
|
||||||
|
|
||||||
#: searx/webutils.py:60
|
#: searx/webutils.py:60
|
||||||
msgid "server API error"
|
msgid "server API error"
|
||||||
msgstr "Tjener-API-feil"
|
msgstr "server API feil"
|
||||||
|
|
||||||
#: searx/webutils.py:79
|
#: searx/webutils.py:79
|
||||||
msgid "Suspended"
|
msgid "Suspended"
|
||||||
|
@ -453,7 +454,7 @@ msgstr "Regn ut {functions} av parameterne"
|
||||||
|
|
||||||
#: searx/engines/mozhi.py:57
|
#: searx/engines/mozhi.py:57
|
||||||
msgid "Synonyms"
|
msgid "Synonyms"
|
||||||
msgstr ""
|
msgstr "Synonymer"
|
||||||
|
|
||||||
#: searx/engines/openstreetmap.py:159
|
#: searx/engines/openstreetmap.py:159
|
||||||
msgid "Get directions"
|
msgid "Get directions"
|
||||||
|
@ -528,7 +529,7 @@ msgstr "Filkvalitet"
|
||||||
|
|
||||||
#: searx/plugins/calculator.py:14
|
#: searx/plugins/calculator.py:14
|
||||||
msgid "Calculate mathematical expressions via the search bar"
|
msgid "Calculate mathematical expressions via the search bar"
|
||||||
msgstr ""
|
msgstr "Kalkuler matematiske uttrykk via søkebaren"
|
||||||
|
|
||||||
#: searx/plugins/hash_plugin.py:10
|
#: searx/plugins/hash_plugin.py:10
|
||||||
msgid "Converts strings to different hash digests."
|
msgid "Converts strings to different hash digests."
|
||||||
|
@ -572,7 +573,7 @@ msgstr ""
|
||||||
|
|
||||||
#: searx/plugins/self_info.py:28
|
#: searx/plugins/self_info.py:28
|
||||||
msgid "Your IP is: "
|
msgid "Your IP is: "
|
||||||
msgstr ""
|
msgstr "Din IP er "
|
||||||
|
|
||||||
#: searx/plugins/self_info.py:31
|
#: searx/plugins/self_info.py:31
|
||||||
msgid "Your user-agent is: "
|
msgid "Your user-agent is: "
|
||||||
|
@ -580,16 +581,16 @@ msgstr ""
|
||||||
|
|
||||||
#: searx/plugins/tor_check.py:24
|
#: searx/plugins/tor_check.py:24
|
||||||
msgid "Tor check plugin"
|
msgid "Tor check plugin"
|
||||||
msgstr "Tor sjekk pluggin"
|
msgstr "Tor sjekking plugin"
|
||||||
|
|
||||||
#: searx/plugins/tor_check.py:27
|
#: searx/plugins/tor_check.py:27
|
||||||
msgid ""
|
msgid ""
|
||||||
"This plugin checks if the address of the request is a Tor exit-node, and "
|
"This plugin checks if the address of the request is a Tor exit-node, and "
|
||||||
"informs the user if it is; like check.torproject.org, but from SearXNG."
|
"informs the user if it is; like check.torproject.org, but from SearXNG."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Denne plugin sjekker om adressen til forespørselen er en Tor utgangsnode,"
|
"Denne plugin-en sjekker om adressen til forespørselen er en Tor utgangsnode, "
|
||||||
" og informerer brukeren om den er det; som check.torproject.org, men fra "
|
"og informerer brukeren om den er det; slik som check.torproject.org gjør, "
|
||||||
"SearXNG."
|
"men fra SearXNG."
|
||||||
|
|
||||||
#: searx/plugins/tor_check.py:61
|
#: searx/plugins/tor_check.py:61
|
||||||
msgid ""
|
msgid ""
|
||||||
|
@ -621,7 +622,7 @@ msgstr "Fjern sporer-argumenter fra returnert nettadresse"
|
||||||
|
|
||||||
#: searx/plugins/unit_converter.py:29
|
#: searx/plugins/unit_converter.py:29
|
||||||
msgid "Convert between units"
|
msgid "Convert between units"
|
||||||
msgstr ""
|
msgstr "Konverter mellom forskjellige enheter"
|
||||||
|
|
||||||
#: searx/templates/simple/404.html:4
|
#: searx/templates/simple/404.html:4
|
||||||
msgid "Page not found"
|
msgid "Page not found"
|
||||||
|
@ -688,7 +689,7 @@ msgstr "Lengde"
|
||||||
|
|
||||||
#: searx/templates/simple/macros.html:41
|
#: searx/templates/simple/macros.html:41
|
||||||
msgid "Views"
|
msgid "Views"
|
||||||
msgstr ""
|
msgstr "Visninger"
|
||||||
|
|
||||||
#: searx/templates/simple/macros.html:42
|
#: searx/templates/simple/macros.html:42
|
||||||
#: searx/templates/simple/result_templates/files.html:34
|
#: searx/templates/simple/result_templates/files.html:34
|
||||||
|
@ -946,7 +947,7 @@ msgstr "Meldinger fra søkemotorene"
|
||||||
|
|
||||||
#: searx/templates/simple/elements/engines_msg.html:7
|
#: searx/templates/simple/elements/engines_msg.html:7
|
||||||
msgid "seconds"
|
msgid "seconds"
|
||||||
msgstr ""
|
msgstr "sekunder"
|
||||||
|
|
||||||
#: searx/templates/simple/elements/search_url.html:3
|
#: searx/templates/simple/elements/search_url.html:3
|
||||||
msgid "Search URL"
|
msgid "Search URL"
|
||||||
|
@ -1068,7 +1069,7 @@ msgstr "Bytt til en annen instans:"
|
||||||
|
|
||||||
#: searx/templates/simple/messages/no_results.html:24
|
#: searx/templates/simple/messages/no_results.html:24
|
||||||
msgid "Search for another query or select another category."
|
msgid "Search for another query or select another category."
|
||||||
msgstr ""
|
msgstr "Oppgi et annet søkeord eller velg en annen kategori."
|
||||||
|
|
||||||
#: searx/templates/simple/messages/no_results.html:25
|
#: searx/templates/simple/messages/no_results.html:25
|
||||||
msgid "Go back to the previous page using the previous page button."
|
msgid "Go back to the previous page using the previous page button."
|
||||||
|
@ -1194,11 +1195,11 @@ msgstr ""
|
||||||
|
|
||||||
#: searx/templates/simple/preferences/engines.html:15
|
#: searx/templates/simple/preferences/engines.html:15
|
||||||
msgid "Enable all"
|
msgid "Enable all"
|
||||||
msgstr ""
|
msgstr "Aktiver alle"
|
||||||
|
|
||||||
#: searx/templates/simple/preferences/engines.html:16
|
#: searx/templates/simple/preferences/engines.html:16
|
||||||
msgid "Disable all"
|
msgid "Disable all"
|
||||||
msgstr ""
|
msgstr "Deaktiver alle"
|
||||||
|
|
||||||
#: searx/templates/simple/preferences/engines.html:25
|
#: searx/templates/simple/preferences/engines.html:25
|
||||||
msgid "!bang"
|
msgid "!bang"
|
||||||
|
|
Binary file not shown.
|
@ -10,13 +10,14 @@
|
||||||
# return42 <return42@users.noreply.translate.codeberg.org>, 2024.
|
# return42 <return42@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# vducong <vducong@users.noreply.translate.codeberg.org>, 2024.
|
# vducong <vducong@users.noreply.translate.codeberg.org>, 2024.
|
||||||
# tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024.
|
# tvminh19 <tvminh19@users.noreply.translate.codeberg.org>, 2024.
|
||||||
|
# KhietVo <KhietVo@users.noreply.translate.codeberg.org>, 2024.
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: searx\n"
|
"Project-Id-Version: searx\n"
|
||||||
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
||||||
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
"POT-Creation-Date: 2024-10-05 06:24+0000\n"
|
||||||
"PO-Revision-Date: 2024-10-26 21:13+0000\n"
|
"PO-Revision-Date: 2024-11-14 14:07+0000\n"
|
||||||
"Last-Translator: return42 <return42@users.noreply.translate.codeberg.org>\n"
|
"Last-Translator: KhietVo <KhietVo@users.noreply.translate.codeberg.org>\n"
|
||||||
"Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/"
|
"Language-Team: Vietnamese <https://translate.codeberg.org/projects/searxng/"
|
||||||
"searxng/vi/>\n"
|
"searxng/vi/>\n"
|
||||||
"Language: vi\n"
|
"Language: vi\n"
|
||||||
|
@ -166,7 +167,7 @@ msgstr "Tối"
|
||||||
#. STYLE_NAMES['BLACK']
|
#. STYLE_NAMES['BLACK']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "black"
|
msgid "black"
|
||||||
msgstr ""
|
msgstr "màu đen"
|
||||||
|
|
||||||
#. BRAND_CUSTOM_LINKS['UPTIME']
|
#. BRAND_CUSTOM_LINKS['UPTIME']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
|
@ -198,7 +199,7 @@ msgstr "Điều kiện"
|
||||||
#: searx/engines/duckduckgo_weather.py:118 searx/engines/wttr.py:104
|
#: searx/engines/duckduckgo_weather.py:118 searx/engines/wttr.py:104
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Current condition"
|
msgid "Current condition"
|
||||||
msgstr ""
|
msgstr "tình hình hiện tại"
|
||||||
|
|
||||||
#. WEATHER_TERMS['EVENING']
|
#. WEATHER_TERMS['EVENING']
|
||||||
#: searx/engines/wttr.py:100 searx/searxng.msg
|
#: searx/engines/wttr.py:100 searx/searxng.msg
|
||||||
|
@ -209,25 +210,25 @@ msgstr "Buổi chiều"
|
||||||
#: searx/engines/duckduckgo_weather.py:53 searx/engines/open_meteo.py:81
|
#: searx/engines/duckduckgo_weather.py:53 searx/engines/open_meteo.py:81
|
||||||
#: searx/engines/wttr.py:59 searx/searxng.msg
|
#: searx/engines/wttr.py:59 searx/searxng.msg
|
||||||
msgid "Feels like"
|
msgid "Feels like"
|
||||||
msgstr ""
|
msgstr "Cảm thấy"
|
||||||
|
|
||||||
#. WEATHER_TERMS['HUMIDITY']
|
#. WEATHER_TERMS['HUMIDITY']
|
||||||
#: searx/engines/duckduckgo_weather.py:64 searx/engines/open_meteo.py:93
|
#: searx/engines/duckduckgo_weather.py:64 searx/engines/open_meteo.py:93
|
||||||
#: searx/engines/wttr.py:68 searx/searxng.msg
|
#: searx/engines/wttr.py:68 searx/searxng.msg
|
||||||
msgid "Humidity"
|
msgid "Humidity"
|
||||||
msgstr ""
|
msgstr "Độ ẩm"
|
||||||
|
|
||||||
#. WEATHER_TERMS['MAX TEMP.']
|
#. WEATHER_TERMS['MAX TEMP.']
|
||||||
#: searx/engines/duckduckgo_weather.py:77 searx/engines/wttr.py:34
|
#: searx/engines/duckduckgo_weather.py:77 searx/engines/wttr.py:34
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Max temp."
|
msgid "Max temp."
|
||||||
msgstr ""
|
msgstr "Nhiệt độ tối đa"
|
||||||
|
|
||||||
#. WEATHER_TERMS['MIN TEMP.']
|
#. WEATHER_TERMS['MIN TEMP.']
|
||||||
#: searx/engines/duckduckgo_weather.py:73 searx/engines/wttr.py:33
|
#: searx/engines/duckduckgo_weather.py:73 searx/engines/wttr.py:33
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Min temp."
|
msgid "Min temp."
|
||||||
msgstr ""
|
msgstr "Nhiệt độ thấp nhất"
|
||||||
|
|
||||||
#. WEATHER_TERMS['MORNING']
|
#. WEATHER_TERMS['MORNING']
|
||||||
#: searx/engines/wttr.py:100 searx/searxng.msg
|
#: searx/engines/wttr.py:100 searx/searxng.msg
|
||||||
|
@ -247,37 +248,37 @@ msgstr "Buổi trưa"
|
||||||
#. WEATHER_TERMS['PRESSURE']
|
#. WEATHER_TERMS['PRESSURE']
|
||||||
#: searx/engines/open_meteo.py:95 searx/searxng.msg
|
#: searx/engines/open_meteo.py:95 searx/searxng.msg
|
||||||
msgid "Pressure"
|
msgid "Pressure"
|
||||||
msgstr ""
|
msgstr "Áp suất"
|
||||||
|
|
||||||
#. WEATHER_TERMS['SUNRISE']
|
#. WEATHER_TERMS['SUNRISE']
|
||||||
#: searx/engines/duckduckgo_weather.py:81 searx/engines/wttr.py:36
|
#: searx/engines/duckduckgo_weather.py:81 searx/engines/wttr.py:36
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Sunrise"
|
msgid "Sunrise"
|
||||||
msgstr ""
|
msgstr "Mặt trời mọc"
|
||||||
|
|
||||||
#. WEATHER_TERMS['SUNSET']
|
#. WEATHER_TERMS['SUNSET']
|
||||||
#: searx/engines/duckduckgo_weather.py:82 searx/engines/wttr.py:37
|
#: searx/engines/duckduckgo_weather.py:82 searx/engines/wttr.py:37
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Sunset"
|
msgid "Sunset"
|
||||||
msgstr ""
|
msgstr "mặt trời lặn"
|
||||||
|
|
||||||
#. WEATHER_TERMS['TEMPERATURE']
|
#. WEATHER_TERMS['TEMPERATURE']
|
||||||
#: searx/engines/duckduckgo_weather.py:48 searx/engines/open_meteo.py:76
|
#: searx/engines/duckduckgo_weather.py:48 searx/engines/open_meteo.py:76
|
||||||
#: searx/engines/wttr.py:55 searx/searxng.msg
|
#: searx/engines/wttr.py:55 searx/searxng.msg
|
||||||
msgid "Temperature"
|
msgid "Temperature"
|
||||||
msgstr ""
|
msgstr "Nhiệt độ"
|
||||||
|
|
||||||
#. WEATHER_TERMS['UV INDEX']
|
#. WEATHER_TERMS['UV INDEX']
|
||||||
#: searx/engines/duckduckgo_weather.py:80 searx/engines/wttr.py:35
|
#: searx/engines/duckduckgo_weather.py:80 searx/engines/wttr.py:35
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "UV index"
|
msgid "UV index"
|
||||||
msgstr ""
|
msgstr "Chỉ số UV"
|
||||||
|
|
||||||
#. WEATHER_TERMS['VISIBILITY']
|
#. WEATHER_TERMS['VISIBILITY']
|
||||||
#: searx/engines/duckduckgo_weather.py:62 searx/engines/wttr.py:66
|
#: searx/engines/duckduckgo_weather.py:62 searx/engines/wttr.py:66
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "Visibility"
|
msgid "Visibility"
|
||||||
msgstr ""
|
msgstr "Tầm nhìn"
|
||||||
|
|
||||||
#. WEATHER_TERMS['WIND']
|
#. WEATHER_TERMS['WIND']
|
||||||
#: searx/engines/duckduckgo_weather.py:58 searx/engines/open_meteo.py:86
|
#: searx/engines/duckduckgo_weather.py:58 searx/engines/open_meteo.py:86
|
||||||
|
@ -288,12 +289,12 @@ msgstr "Gió"
|
||||||
#. SOCIAL_MEDIA_TERMS['SUBSCRIBERS']
|
#. SOCIAL_MEDIA_TERMS['SUBSCRIBERS']
|
||||||
#: searx/engines/lemmy.py:85 searx/searxng.msg
|
#: searx/engines/lemmy.py:85 searx/searxng.msg
|
||||||
msgid "subscribers"
|
msgid "subscribers"
|
||||||
msgstr ""
|
msgstr "người đăng ký"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['POSTS']
|
#. SOCIAL_MEDIA_TERMS['POSTS']
|
||||||
#: searx/engines/lemmy.py:86 searx/searxng.msg
|
#: searx/engines/lemmy.py:86 searx/searxng.msg
|
||||||
msgid "posts"
|
msgid "posts"
|
||||||
msgstr ""
|
msgstr "những bài đăng"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['ACTIVE USERS']
|
#. SOCIAL_MEDIA_TERMS['ACTIVE USERS']
|
||||||
#: searx/engines/lemmy.py:87 searx/searxng.msg
|
#: searx/engines/lemmy.py:87 searx/searxng.msg
|
||||||
|
@ -309,42 +310,42 @@ msgstr ""
|
||||||
#. SOCIAL_MEDIA_TERMS['USER']
|
#. SOCIAL_MEDIA_TERMS['USER']
|
||||||
#: searx/engines/lemmy.py:129 searx/engines/lemmy.py:164 searx/searxng.msg
|
#: searx/engines/lemmy.py:129 searx/engines/lemmy.py:164 searx/searxng.msg
|
||||||
msgid "user"
|
msgid "user"
|
||||||
msgstr ""
|
msgstr "người dùng"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['COMMUNITY']
|
#. SOCIAL_MEDIA_TERMS['COMMUNITY']
|
||||||
#: searx/engines/lemmy.py:131 searx/engines/lemmy.py:165 searx/searxng.msg
|
#: searx/engines/lemmy.py:131 searx/engines/lemmy.py:165 searx/searxng.msg
|
||||||
msgid "community"
|
msgid "community"
|
||||||
msgstr ""
|
msgstr "cộng đồng"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['POINTS']
|
#. SOCIAL_MEDIA_TERMS['POINTS']
|
||||||
#: searx/engines/hackernews.py:78 searx/searxng.msg
|
#: searx/engines/hackernews.py:78 searx/searxng.msg
|
||||||
msgid "points"
|
msgid "points"
|
||||||
msgstr ""
|
msgstr "điểm"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['TITLE']
|
#. SOCIAL_MEDIA_TERMS['TITLE']
|
||||||
#: searx/searxng.msg
|
#: searx/searxng.msg
|
||||||
msgid "title"
|
msgid "title"
|
||||||
msgstr ""
|
msgstr "tiêu đề"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['AUTHOR']
|
#. SOCIAL_MEDIA_TERMS['AUTHOR']
|
||||||
#: searx/engines/hackernews.py:81 searx/searxng.msg
|
#: searx/engines/hackernews.py:81 searx/searxng.msg
|
||||||
msgid "author"
|
msgid "author"
|
||||||
msgstr ""
|
msgstr "tác giả"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD OPEN']
|
#. SOCIAL_MEDIA_TERMS['THREAD OPEN']
|
||||||
#: searx/engines/discourse.py:149 searx/searxng.msg
|
#: searx/engines/discourse.py:149 searx/searxng.msg
|
||||||
msgid "open"
|
msgid "open"
|
||||||
msgstr ""
|
msgstr "mở"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD CLOSED']
|
#. SOCIAL_MEDIA_TERMS['THREAD CLOSED']
|
||||||
#: searx/engines/discourse.py:149 searx/searxng.msg
|
#: searx/engines/discourse.py:149 searx/searxng.msg
|
||||||
msgid "closed"
|
msgid "closed"
|
||||||
msgstr ""
|
msgstr "đóng"
|
||||||
|
|
||||||
#. SOCIAL_MEDIA_TERMS['THREAD ANSWERED']
|
#. SOCIAL_MEDIA_TERMS['THREAD ANSWERED']
|
||||||
#: searx/engines/discourse.py:160 searx/searxng.msg
|
#: searx/engines/discourse.py:160 searx/searxng.msg
|
||||||
msgid "answered"
|
msgid "answered"
|
||||||
msgstr ""
|
msgstr "đã trả lời"
|
||||||
|
|
||||||
#: searx/webapp.py:332
|
#: searx/webapp.py:332
|
||||||
msgid "No item found"
|
msgid "No item found"
|
||||||
|
@ -529,7 +530,7 @@ msgstr "Chất lượng tệp"
|
||||||
|
|
||||||
#: searx/plugins/calculator.py:14
|
#: searx/plugins/calculator.py:14
|
||||||
msgid "Calculate mathematical expressions via the search bar"
|
msgid "Calculate mathematical expressions via the search bar"
|
||||||
msgstr ""
|
msgstr "Tính toán bằng thanh tìm kiếm"
|
||||||
|
|
||||||
#: searx/plugins/hash_plugin.py:10
|
#: searx/plugins/hash_plugin.py:10
|
||||||
msgid "Converts strings to different hash digests."
|
msgid "Converts strings to different hash digests."
|
||||||
|
@ -540,12 +541,14 @@ msgid "hash digest"
|
||||||
msgstr "hash băm"
|
msgstr "hash băm"
|
||||||
|
|
||||||
#: searx/plugins/hostnames.py:103
|
#: searx/plugins/hostnames.py:103
|
||||||
|
#, fuzzy
|
||||||
msgid "Hostnames plugin"
|
msgid "Hostnames plugin"
|
||||||
msgstr ""
|
msgstr "Mấy chủ bổ trợ"
|
||||||
|
|
||||||
#: searx/plugins/hostnames.py:104
|
#: searx/plugins/hostnames.py:104
|
||||||
msgid "Rewrite hostnames, remove results or prioritize them based on the hostname"
|
msgid "Rewrite hostnames, remove results or prioritize them based on the hostname"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
"Viết lại máy chủ, xoá các kểt quả tìm kiếm hoặc sắp xếp dựa trên máy chủ"
|
||||||
|
|
||||||
#: searx/plugins/oa_doi_rewrite.py:12
|
#: searx/plugins/oa_doi_rewrite.py:12
|
||||||
msgid "Open Access DOI rewrite"
|
msgid "Open Access DOI rewrite"
|
||||||
|
@ -571,7 +574,7 @@ msgstr "Hiện IP của bạn khi gõ \"ip\" và hiện user agent khi gõ \"use
|
||||||
|
|
||||||
#: searx/plugins/self_info.py:28
|
#: searx/plugins/self_info.py:28
|
||||||
msgid "Your IP is: "
|
msgid "Your IP is: "
|
||||||
msgstr ""
|
msgstr "Địa chỉ IP của bạn: "
|
||||||
|
|
||||||
#: searx/plugins/self_info.py:31
|
#: searx/plugins/self_info.py:31
|
||||||
msgid "Your user-agent is: "
|
msgid "Your user-agent is: "
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
from searx.search import SearchQuery, EngineRef
|
from searx.search import SearchQuery, EngineRef
|
||||||
from searx.search.processors import online
|
from searx.search.processors import online
|
||||||
from searx.engines import load_engines
|
import searx.search
|
||||||
from searx import engines
|
from searx import engines
|
||||||
|
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
@ -22,10 +22,10 @@ TEST_ENGINE = {
|
||||||
class TestOnlineProcessor(SearxTestCase): # pylint: disable=missing-class-docstring
|
class TestOnlineProcessor(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
load_engines([TEST_ENGINE])
|
searx.search.initialize([TEST_ENGINE])
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
load_engines([])
|
searx.search.load_engines([])
|
||||||
|
|
||||||
def _get_params(self, online_processor, search_query, engine_category):
|
def _get_params(self, online_processor, search_query, engine_category):
|
||||||
params = online_processor.get_params(search_query, engine_category)
|
params = online_processor.get_params(search_query, engine_category)
|
||||||
|
|
|
@ -2,26 +2,11 @@
|
||||||
# pylint: disable=missing-module-docstring
|
# pylint: disable=missing-module-docstring
|
||||||
|
|
||||||
from unittest.mock import MagicMock, Mock
|
from unittest.mock import MagicMock, Mock
|
||||||
from searx.engines import load_engines, mariadb_server
|
from searx.engines import mariadb_server
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
|
||||||
|
|
||||||
class MariadbServerTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
class MariadbServerTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
def setUp(self):
|
|
||||||
load_engines(
|
|
||||||
[
|
|
||||||
{
|
|
||||||
'name': 'mariadb server',
|
|
||||||
'engine': 'mariadb_server',
|
|
||||||
'shortcut': 'mdb',
|
|
||||||
'timeout': 9.0,
|
|
||||||
'disabled': True,
|
|
||||||
}
|
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
load_engines([])
|
|
||||||
|
|
||||||
def test_init_no_query_str_raises(self):
|
def test_init_no_query_str_raises(self):
|
||||||
self.assertRaises(ValueError, lambda: mariadb_server.init({}))
|
self.assertRaises(ValueError, lambda: mariadb_server.init({}))
|
||||||
|
|
|
@ -1,28 +1,34 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
# pylint: disable=missing-module-docstring
|
# pylint: disable=missing-module-docstring
|
||||||
|
|
||||||
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from unittest.mock import Mock
|
from unittest.mock import Mock
|
||||||
from requests import HTTPError
|
from requests import HTTPError
|
||||||
from parameterized import parameterized
|
from parameterized import parameterized
|
||||||
from searx.engines import load_engines, tineye
|
import searx.search
|
||||||
|
import searx.engines
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
|
||||||
|
|
||||||
class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
load_engines([{'name': 'tineye', 'engine': 'tineye', 'shortcut': 'tin', 'timeout': 9.0, 'disabled': True}])
|
searx.search.initialize(
|
||||||
|
[{'name': 'tineye', 'engine': 'tineye', 'shortcut': 'tin', 'timeout': 9.0, 'disabled': True}]
|
||||||
|
)
|
||||||
|
|
||||||
|
self.tineye = searx.engines.engines['tineye']
|
||||||
|
self.tineye.logger.setLevel(logging.CRITICAL)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
load_engines([])
|
searx.search.load_engines([])
|
||||||
|
|
||||||
def test_status_code_raises(self):
|
def test_status_code_raises(self):
|
||||||
response = Mock()
|
response = Mock()
|
||||||
response.status_code = 401
|
response.status_code = 401
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
self.assertRaises(HTTPError, lambda: tineye.response(response))
|
self.assertRaises(HTTPError, lambda: self.tineye.response(response))
|
||||||
|
|
||||||
@parameterized.expand([(400), (422)])
|
@parameterized.expand([(400), (422)])
|
||||||
def test_returns_empty_list(self, status_code):
|
def test_returns_empty_list(self, status_code):
|
||||||
|
@ -30,7 +36,7 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
response.json.return_value = {}
|
response.json.return_value = {}
|
||||||
response.status_code = status_code
|
response.status_code = status_code
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
results = tineye.response(response)
|
results = self.tineye.response(response)
|
||||||
self.assertEqual(0, len(results))
|
self.assertEqual(0, len(results))
|
||||||
|
|
||||||
def test_logs_format_for_422(self):
|
def test_logs_format_for_422(self):
|
||||||
|
@ -39,9 +45,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
response.status_code = 422
|
response.status_code = 422
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
|
|
||||||
with self.assertLogs(tineye.logger) as assert_logs_context:
|
with self.assertLogs(self.tineye.logger) as assert_logs_context:
|
||||||
tineye.response(response)
|
self.tineye.response(response)
|
||||||
self.assertIn(tineye.FORMAT_NOT_SUPPORTED, ','.join(assert_logs_context.output))
|
self.assertIn(self.tineye.FORMAT_NOT_SUPPORTED, ','.join(assert_logs_context.output))
|
||||||
|
|
||||||
def test_logs_signature_for_422(self):
|
def test_logs_signature_for_422(self):
|
||||||
response = Mock()
|
response = Mock()
|
||||||
|
@ -49,9 +55,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
response.status_code = 422
|
response.status_code = 422
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
|
|
||||||
with self.assertLogs(tineye.logger) as assert_logs_context:
|
with self.assertLogs(self.tineye.logger) as assert_logs_context:
|
||||||
tineye.response(response)
|
self.tineye.response(response)
|
||||||
self.assertIn(tineye.NO_SIGNATURE_ERROR, ','.join(assert_logs_context.output))
|
self.assertIn(self.tineye.NO_SIGNATURE_ERROR, ','.join(assert_logs_context.output))
|
||||||
|
|
||||||
def test_logs_download_for_422(self):
|
def test_logs_download_for_422(self):
|
||||||
response = Mock()
|
response = Mock()
|
||||||
|
@ -59,9 +65,9 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
response.status_code = 422
|
response.status_code = 422
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
|
|
||||||
with self.assertLogs(tineye.logger) as assert_logs_context:
|
with self.assertLogs(self.tineye.logger) as assert_logs_context:
|
||||||
tineye.response(response)
|
self.tineye.response(response)
|
||||||
self.assertIn(tineye.DOWNLOAD_ERROR, ','.join(assert_logs_context.output))
|
self.assertIn(self.tineye.DOWNLOAD_ERROR, ','.join(assert_logs_context.output))
|
||||||
|
|
||||||
def test_logs_description_for_400(self):
|
def test_logs_description_for_400(self):
|
||||||
description = 'There was a problem with that request. Error ID: ad5fc955-a934-43c1-8187-f9a61d301645'
|
description = 'There was a problem with that request. Error ID: ad5fc955-a934-43c1-8187-f9a61d301645'
|
||||||
|
@ -70,8 +76,8 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
response.status_code = 400
|
response.status_code = 400
|
||||||
response.raise_for_status.side_effect = HTTPError()
|
response.raise_for_status.side_effect = HTTPError()
|
||||||
|
|
||||||
with self.assertLogs(tineye.logger) as assert_logs_context:
|
with self.assertLogs(self.tineye.logger) as assert_logs_context:
|
||||||
tineye.response(response)
|
self.tineye.response(response)
|
||||||
self.assertIn(description, ','.join(assert_logs_context.output))
|
self.assertIn(description, ','.join(assert_logs_context.output))
|
||||||
|
|
||||||
def test_crawl_date_parses(self):
|
def test_crawl_date_parses(self):
|
||||||
|
@ -90,5 +96,5 @@ class TinEyeTests(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
response.status_code = 200
|
response.status_code = 200
|
||||||
results = tineye.response(response)
|
results = self.tineye.response(response)
|
||||||
self.assertEqual(date, results[0]['publishedDate'])
|
self.assertEqual(date, results[0]['publishedDate'])
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# pylint: disable=missing-module-docstring
|
# pylint: disable=missing-module-docstring
|
||||||
|
|
||||||
from parameterized.parameterized import parameterized
|
from parameterized.parameterized import parameterized
|
||||||
from searx.engines import load_engines
|
import searx.search
|
||||||
from searx.query import RawTextQuery
|
from searx.query import RawTextQuery
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
|
||||||
|
@ -218,10 +218,10 @@ class TestBang(SearxTestCase): # pylint:disable=missing-class-docstring
|
||||||
THE_QUERY = 'the query'
|
THE_QUERY = 'the query'
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
load_engines(TEST_ENGINES)
|
searx.search.initialize(TEST_ENGINES)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
load_engines([])
|
searx.search.load_engines([])
|
||||||
|
|
||||||
@parameterized.expand(SPECIFIC_BANGS)
|
@parameterized.expand(SPECIFIC_BANGS)
|
||||||
def test_bang(self, bang: str):
|
def test_bang(self, bang: str):
|
||||||
|
|
|
@ -2,9 +2,26 @@
|
||||||
# pylint: disable=missing-module-docstring
|
# pylint: disable=missing-module-docstring
|
||||||
|
|
||||||
from searx.results import ResultContainer
|
from searx.results import ResultContainer
|
||||||
|
import searx.search
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
|
||||||
|
|
||||||
|
def make_test_engine_dict(**kwargs) -> dict:
|
||||||
|
test_engine = {
|
||||||
|
# fmt: off
|
||||||
|
'name': None,
|
||||||
|
'engine': None,
|
||||||
|
'categories': 'general',
|
||||||
|
'shortcut': 'dummy',
|
||||||
|
'timeout': 3.0,
|
||||||
|
'tokens': [],
|
||||||
|
# fmt: on
|
||||||
|
}
|
||||||
|
|
||||||
|
test_engine.update(**kwargs)
|
||||||
|
return test_engine
|
||||||
|
|
||||||
|
|
||||||
def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', engine='wikipedia', **kwargs):
|
def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', engine='wikipedia', **kwargs):
|
||||||
result = {
|
result = {
|
||||||
# fmt: off
|
# fmt: off
|
||||||
|
@ -19,23 +36,40 @@ def fake_result(url='https://aa.bb/cc?dd=ee#ff', title='aaa', content='bbb', eng
|
||||||
|
|
||||||
|
|
||||||
class ResultContainerTestCase(SearxTestCase): # pylint: disable=missing-class-docstring
|
class ResultContainerTestCase(SearxTestCase): # pylint: disable=missing-class-docstring
|
||||||
|
|
||||||
|
def setUp(self) -> None:
|
||||||
|
stract_engine = make_test_engine_dict(name="stract", engine="stract", shortcut="stra")
|
||||||
|
duckduckgo_engine = make_test_engine_dict(name="duckduckgo", engine="duckduckgo", shortcut="ddg")
|
||||||
|
mojeek_engine = make_test_engine_dict(name="mojeek", engine="mojeek", shortcut="mjk")
|
||||||
|
searx.search.initialize([stract_engine, duckduckgo_engine, mojeek_engine])
|
||||||
|
self.container = ResultContainer()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
searx.search.load_engines([])
|
||||||
|
|
||||||
def test_empty(self):
|
def test_empty(self):
|
||||||
c = ResultContainer()
|
self.assertEqual(self.container.get_ordered_results(), [])
|
||||||
self.assertEqual(c.get_ordered_results(), [])
|
|
||||||
|
|
||||||
def test_one_result(self):
|
def test_one_result(self):
|
||||||
c = ResultContainer()
|
self.container.extend('wikipedia', [fake_result()])
|
||||||
c.extend('wikipedia', [fake_result()])
|
|
||||||
self.assertEqual(c.results_length(), 1)
|
self.assertEqual(self.container.results_length(), 1)
|
||||||
|
|
||||||
def test_one_suggestion(self):
|
def test_one_suggestion(self):
|
||||||
c = ResultContainer()
|
self.container.extend('wikipedia', [fake_result(suggestion=True)])
|
||||||
c.extend('wikipedia', [fake_result(suggestion=True)])
|
|
||||||
self.assertEqual(len(c.suggestions), 1)
|
self.assertEqual(len(self.container.suggestions), 1)
|
||||||
self.assertEqual(c.results_length(), 0)
|
self.assertEqual(self.container.results_length(), 0)
|
||||||
|
|
||||||
def test_result_merge(self):
|
def test_result_merge(self):
|
||||||
c = ResultContainer()
|
self.container.extend('wikipedia', [fake_result()])
|
||||||
c.extend('wikipedia', [fake_result()])
|
self.container.extend('wikidata', [fake_result(), fake_result(url='https://example.com/')])
|
||||||
c.extend('wikidata', [fake_result(), fake_result(url='https://example.com/')])
|
|
||||||
self.assertEqual(c.results_length(), 2)
|
self.assertEqual(self.container.results_length(), 2)
|
||||||
|
|
||||||
|
def test_result_merge_by_title(self):
|
||||||
|
self.container.extend('stract', [fake_result(engine='stract', title='short title')])
|
||||||
|
self.container.extend('duckduckgo', [fake_result(engine='duckduckgo', title='normal title')])
|
||||||
|
self.container.extend('mojeek', [fake_result(engine='mojeek', title='this long long title')])
|
||||||
|
|
||||||
|
self.assertEqual(self.container.get_ordered_results()[0].get('title', ''), 'this long long title')
|
||||||
|
|
Loading…
Reference in New Issue