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

Public Member Functions

OnlineUrlSearchParams|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 used by ``online_url_search`` engines.

Definition at line 32 of file online_url_search.py.

Member Function Documentation

◆ get_params()

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

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

Definition at line 37 of file online_url_search.py.

37 def get_params(self, search_query: "SearchQuery", engine_category: str) -> OnlineUrlSearchParams | None:
38 """Returns a dictionary with the :ref:`request params <engine request
39 online_currency>` (:py:obj:`OnlineUrlSearchParams`). ``None`` is
40 returned if the search query does not match :py:obj:`search_syntax`."""
41
42 online_params: OnlineParams | None = super().get_params(search_query, engine_category)
43 if online_params is None:
44 return None
45
46 search_urls: dict[str, str | None] = {}
47 has_match: bool = False
48
49 for url_schema, url_re in search_syntax.items():
50 search_urls[url_schema] = None
51 m = url_re.search(search_query.query)
52 if m:
53 has_match = True
54 search_urls[url_schema] = m[0]
55
56 if not has_match:
57 return None
58
59 params: OnlineUrlSearchParams = {
60 **online_params,
61 "search_urls": search_urls,
62 }
63
64 return params

References 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: