Compare commits

...

6 Commits

Author SHA1 Message Date
Grant Lanham Jr 9a8d763e82
Merge 81f0cb01e8 into 10d3af84b8 2024-11-18 09:11:31 +01:00
Markus Heiser 10d3af84b8 [fix] engine: duckduckgo - don't quote query string
The query string send to DDG must not be qouted.

The query string was URL-qouted in #4011, but the URL-qouted query string result
in unexpected *URL decoded* and other garbish results as reported in #4019
and #4020.  To test compare the results of a query like::

    !ddg Häuser und Straßen :de
    !ddg Häuser und Straßen :all
    !ddg 房屋和街道 :all
    !ddg 房屋和街道 :zh

Closed:

- [#4019] https://github.com/searxng/searxng/issues/4019
- [#4020] https://github.com/searxng/searxng/issues/4020

Related:

- [#4011] https://github.com/searxng/searxng/pull/4011

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
2024-11-17 18:14:22 +01:00
dependabot[bot] 4b57bc3db1 [upd] pypi: Bump flask from 3.0.3 to 3.1.0
Bumps [flask](https://github.com/pallets/flask) from 3.0.3 to 3.1.0.
- [Release notes](https://github.com/pallets/flask/releases)
- [Changelog](https://github.com/pallets/flask/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/flask/compare/3.0.3...3.1.0)

---
updated-dependencies:
- dependency-name: flask
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 13:23:24 +01:00
searxng-bot a345cbbe51 [l10n] update translations from Weblate
0216898a3 - 2024-11-14 - KhietVo <KhietVo@users.noreply.translate.codeberg.org>
3293db4c8 - 2024-11-14 - return42 <return42@users.noreply.translate.codeberg.org>
574e0d683 - 2024-11-13 - lrnz2 <lrnz2@users.noreply.translate.codeberg.org>
a32d9d158 - 2024-11-08 - Aadniz <Aadniz@users.noreply.translate.codeberg.org>
2024-11-15 13:20:52 +01:00
Nicolas Dato abd9b271bc [fix] engine: duckduckgo - only uses first word of the search terms
during the revision in PR #3955 the query string was accidentally converted into
a list of words, further the query must be quoted before POSTed in the ``data``
field, see ``urllib.parse.quote_plus`` [1]

[1] https://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote_plus

Closed: #4009
Co-Authored-by: @return42
2024-11-14 09:33:54 +01:00
Grant Lanham 81f0cb01e8 Remove RawTextQuery.changeQuery in favor of getNewFullQuery
Also includes the following:
- Introduce typing in RawTextQuery
- Remove an outdated description based on the change
- Refactor setting the autocomplete_location, its more clear to set the
variable in the construct instead of within the method
- Update unit tests to reflect the new method

rephrasing

format

undo change
2024-06-16 14:18:31 -04:00
14 changed files with 118 additions and 93 deletions

View File

@ -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

View File

@ -245,10 +245,12 @@ def request(query, params):
# Advanced search syntax ends in CAPTCHA # Advanced search syntax ends in CAPTCHA
# https://duckduckgo.com/duckduckgo-help-pages/results/syntax/ # https://duckduckgo.com/duckduckgo-help-pages/results/syntax/
query = [ query = " ".join(
[
x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:") x.removeprefix("site:").removeprefix("intitle:").removeprefix("inurl:").removeprefix("filetype:")
for x in query.split() for x in query.split()
] ]
)
eng_region = traits.get_region(params['searxng_locale'], traits.all_locale) eng_region = traits.get_region(params['searxng_locale'], traits.all_locale)
if eng_region == "wt-wt": if eng_region == "wt-wt":
# https://html.duckduckgo.com/html sets an empty value for "all". # https://html.duckduckgo.com/html sets an empty value for "all".
@ -379,7 +381,11 @@ def response(resp):
zero_click_info_xpath = '//div[@id="zero_click_abstract"]' zero_click_info_xpath = '//div[@id="zero_click_abstract"]'
zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip() zero_click = extract_text(eval_xpath(doc, zero_click_info_xpath)).strip()
if zero_click and "Your IP address is" not in zero_click and "Your user agent:" not in zero_click: if zero_click and (
"Your IP address is" not in zero_click
and "Your user agent:" not in zero_click
and "URL Decoded:" not in zero_click
):
current_query = resp.search_params["data"].get("q") current_query = resp.search_params["data"].get("q")
results.append( results.append(

View File

@ -1,10 +1,10 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=invalid-name, missing-module-docstring, missing-class-docstring # pylint: disable=invalid-name, missing-module-docstring, missing-class-docstring
from __future__ import annotations
from __future__ import annotations from __future__ import annotations
from abc import abstractmethod, ABC from abc import abstractmethod, ABC
import re import re
from searx import settings from searx import settings
from searx.sxng_locales import sxng_locales from searx.sxng_locales import sxng_locales
from searx.engines import categories, engines, engine_shortcuts from searx.engines import categories, engines, engine_shortcuts
@ -272,16 +272,19 @@ class RawTextQuery:
self.specific = False self.specific = False
self.autocomplete_list = [] self.autocomplete_list = []
# internal properties # internal properties
self.query_parts = [] # use self.getFullQuery() self.query_parts = [] # use self.getFullQuery() or self.getNewFullQuery(query)
self.user_query_parts = [] # use self.getQuery() self.user_query_parts = [] # use self.getQuery()
self.autocomplete_location = None
self.redirect_to_first_result = False self.redirect_to_first_result = False
self._parse_query() self.autocomplete_location = self._parse_query()
def _parse_query(self): def _parse_query(self):
""" """
parse self.query, if tags are set, which parse self.query, if tags are set, which
change the search engine or search-language change the search engine or search-language
Returns a tuple:
[0] The query parts as a list
[1] The indexor into the above list
""" """
# split query, including whitespaces # split query, including whitespaces
@ -307,28 +310,33 @@ class RawTextQuery:
qlist.append(query_part) qlist.append(query_part)
last_index_location = (qlist, len(qlist) - 1) last_index_location = (qlist, len(qlist) - 1)
self.autocomplete_location = last_index_location return last_index_location
def get_autocomplete_full_query(self, text): def get_autocomplete_full_query(self, text: str) -> str:
assert self.autocomplete_location is not None
qlist, position = self.autocomplete_location qlist, position = self.autocomplete_location
qlist[position] = text qlist[position] = text
return self.getFullQuery() return self.getFullQuery()
def changeQuery(self, query): def getNewFullQuery(self, query: str):
self.user_query_parts = query.strip().split() """
self.query = self.getFullQuery() Generate a new FullQuery based on the input query rather than the internal
self.autocomplete_location = (self.user_query_parts, len(self.user_query_parts) - 1) user_query_parts
self.autocomplete_list = [] """
return self return RawTextQuery._getFullQuery(self.query_parts, query.strip())
def getQuery(self): def getQuery(self) -> str:
return ' '.join(self.user_query_parts) return ' '.join(self.user_query_parts)
def getFullQuery(self): def getFullQuery(self) -> str:
""" """
get full query including whitespaces Get full query including whitespaces
""" """
return '{0} {1}'.format(' '.join(self.query_parts), self.getQuery()).strip() return RawTextQuery._getFullQuery(self.query_parts, self.getQuery())
@staticmethod
def _getFullQuery(query_parts: list[str], query: str) -> str:
return '{0} {1}'.format(' '.join(query_parts), query).strip()
def __str__(self): def __str__(self):
return self.getFullQuery() return self.getFullQuery()

View File

@ -144,6 +144,7 @@ class EngineProcessor(ABC):
- A page-number > 1 when engine does not support paging. - A page-number > 1 when engine does not support paging.
- A time range when the engine does not support time range. - A time range when the engine does not support time range.
""" """
# if paging is not supported, skip # if paging is not supported, skip
if search_query.pageno > 1 and not self.engine.paging: if search_query.pageno > 1 and not self.engine.paging:
return None return None

View File

@ -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 ""

View File

@ -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

View File

@ -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"

View File

@ -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: "

View File

@ -753,14 +753,14 @@ def search():
# suggestions: use RawTextQuery to get the suggestion URLs with the same bang # suggestions: use RawTextQuery to get the suggestion URLs with the same bang
suggestion_urls = list( suggestion_urls = list(
map( map(
lambda suggestion: {'url': raw_text_query.changeQuery(suggestion).getFullQuery(), 'title': suggestion}, lambda suggestion: {'url': raw_text_query.getNewFullQuery(suggestion), 'title': suggestion},
result_container.suggestions, result_container.suggestions,
) )
) )
correction_urls = list( correction_urls = list(
map( map(
lambda correction: {'url': raw_text_query.changeQuery(correction).getFullQuery(), 'title': correction}, lambda correction: {'url': raw_text_query.getNewFullQuery(correction), 'title': correction},
result_container.corrections, result_container.corrections,
) )
) )
@ -851,10 +851,8 @@ def autocompleter():
backend_name = request.preferences.get_value('autocomplete') backend_name = request.preferences.get_value('autocomplete')
for result in search_autocomplete(backend_name, sug_prefix, sxng_locale): for result in search_autocomplete(backend_name, sug_prefix, sxng_locale):
# attention: this loop will change raw_text_query object and this is
# the reason why the sug_prefix was stored before (see above)
if result != sug_prefix: if result != sug_prefix:
results.append(raw_text_query.changeQuery(result).getFullQuery()) results.append(raw_text_query.getNewFullQuery(result))
if len(raw_text_query.autocomplete_list) > 0: if len(raw_text_query.autocomplete_list) > 0:
for autocomplete_text in raw_text_query.autocomplete_list: for autocomplete_text in raw_text_query.autocomplete_list:

View File

@ -51,12 +51,19 @@ class TestQuery(SearxTestCase): # pylint:disable=missing-class-docstring
r = repr(query) r = repr(query)
self.assertTrue(r.startswith(f"<RawTextQuery query='{query_text}' ")) self.assertTrue(r.startswith(f"<RawTextQuery query='{query_text}' "))
def test_change_query(self): def test_get_new_full_query(self):
query_text = '<8 the query' query_text = '<8 the query'
query = RawTextQuery(query_text, []) query = RawTextQuery(query_text, [])
another_query = query.changeQuery('another text') full_query = query.getFullQuery()
self.assertEqual(query, another_query) new_full_query = query.getNewFullQuery('another text')
self.assertEqual(query.getFullQuery(), '<8 another text') self.assertNotEqual(full_query, new_full_query)
def test_get_new_full_query_trim(self):
query_text = 'foo bar'
query = RawTextQuery(query_text, [])
new_query = 'bizz bazz'
new_full_query = query.getNewFullQuery(" " + new_query + " ")
self.assertEqual(new_query, new_full_query)
class TestLanguageParser(SearxTestCase): # pylint:disable=missing-class-docstring class TestLanguageParser(SearxTestCase): # pylint:disable=missing-class-docstring