.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.search.processors.online_dictionary.OnlineDictionaryProcessor Class Reference
Inheritance diagram for searx.search.processors.online_dictionary.OnlineDictionaryProcessor:
Collaboration diagram for searx.search.processors.online_dictionary.OnlineDictionaryProcessor:

Public Member Functions

OnlineDictParams|None get_params (self, "SearchQuery" search_query, str engine_category)
Public Member Functions inherited from searx.search.processors.online.OnlineProcessor
bool init_engine (self)
 init_network_in_thread (self, float start_time, float timeout_limit)
 search (self, str query, OnlineParams params, "ResultContainer" result_container, float start_time, float timeout_limit)
Public Member Functions inherited from searx.search.processors.abstract.EngineProcessor
 __init__ (self, "Engine|types.ModuleType" engine)
 initialize (self, t.Callable[["EngineProcessor", bool], bool] callback)
 handle_exception (self, "ResultContainer" result_container, BaseException|str exception_or_message, bool suspend=False)
 extend_container (self, "ResultContainer" result_container, float start_time, "list[Result | LegacyResult]|None" search_results)
bool extend_container_if_suspended (self, "ResultContainer" result_container)
 get_tests (self)
 get_default_tests (self)

Additional Inherited Members

Public Attributes inherited from searx.search.processors.abstract.EngineProcessor
 engine = engine
logging.Logger logger = engines[engine.name].logger
SuspendedStatus suspended_status = SUSPENDED_STATUS.setdefault(key, SuspendedStatus())
Static Public Attributes inherited from searx.search.processors.online.OnlineProcessor
str engine_type = "online"
Protected Member Functions inherited from searx.search.processors.online.OnlineProcessor
 _send_http_request (self, OnlineParams params)
"EngineResults|None" _search_basic (self, str query, OnlineParams params)
Protected Member Functions inherited from searx.search.processors.abstract.EngineProcessor
 _extend_container_basic (self, "ResultContainer" result_container, float start_time, "list[Result | LegacyResult]" search_results)

Detailed Description

Processor class for ``online_dictionary`` engines.

Definition at line 37 of file online_dictionary.py.

Member Function Documentation

◆ get_params()

OnlineDictParams | None searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_params ( self,
"SearchQuery" search_query,
str engine_category )
Returns a dictionary with the :ref:`request params <engine request
online_dictionary>` (:py:obj:`OnlineDictParams`).  ``None`` is returned
if the search query does not match :py:obj:`search_syntax`.

Reimplemented from searx.search.processors.online.OnlineProcessor.

Definition at line 42 of file online_dictionary.py.

42 def get_params(self, search_query: "SearchQuery", engine_category: str) -> OnlineDictParams | None:
43 """Returns a dictionary with the :ref:`request params <engine request
44 online_dictionary>` (:py:obj:`OnlineDictParams`). ``None`` is returned
45 if the search query does not match :py:obj:`search_syntax`."""
46
47 online_params: OnlineParams | None = super().get_params(search_query, engine_category)
48 if online_params is None:
49 return None
50 m = search_syntax.match(search_query.query)
51 if not m:
52 return None
53
54 from_lang, to_lang, query = m.groups()
55 from_lang = _get_lang_descr(from_lang)
56 to_lang = _get_lang_descr(to_lang)
57 if not from_lang or not to_lang:
58 return None
59
60 params: OnlineDictParams = {
61 **online_params,
62 "from_lang": from_lang,
63 "to_lang": to_lang,
64 "query": query,
65 }
66
67 return params
68
69

References searx.search.processors.online_dictionary._get_lang_descr(), and get_params().

Referenced by get_params().

Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: