43 def post_search(self, request:
"SXNG_Request", search:
"SearchWithPlugins") -> EngineResults:
47 if search.search_query.pageno > 1:
50 query = search.search_query.query
56 query = query.replace(
"x",
"*").replace(
":",
"/")
59 ui_locale = babel.Locale.parse(request.preferences.get_value(
"locale"), sep=
"-")
62 def _decimal(match: re.Match) -> str:
63 val = match.string[match.start() : match.end()]
64 val = babel.numbers.parse_decimal(val, ui_locale, numbering_system=
"latn")
67 decimal = ui_locale.number_symbols[
"latn"][
"decimal"]
68 group = ui_locale.number_symbols[
"latn"][
"group"]
69 query = re.sub(f
"[0-9]+[{decimal}|{group}][0-9]+[{decimal}|{group}]?[0-9]?", _decimal, query)
72 if any(str.isalpha(c)
for c
in query):
76 query_py_formatted = query.replace(
"^",
"**")
80 if res
is None or res ==
"":
83 res = babel.numbers.format_decimal(res, locale=ui_locale)
84 results.add(results.types.Answer(answer=f
"{search.search_query.query} = {res}"))