.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

 get_params (self, search_query, engine_category)
 
 get_default_tests (self)
 
- Public Member Functions inherited from searx.search.processors.online.OnlineProcessor
 initialize (self)
 
 search (self, query, params, result_container, start_time, timeout_limit)
 
- Public Member Functions inherited from searx.search.processors.abstract.EngineProcessor
 __init__ (self, engine, str engine_name)
 
 has_initialize_function (self)
 
 handle_exception (self, result_container, exception_or_message, suspend=False)
 
 extend_container (self, result_container, start_time, search_results)
 
 extend_container_if_suspended (self, result_container)
 
 get_tests (self)
 

Public Attributes

 engine
 
- Public Attributes inherited from searx.search.processors.online.OnlineProcessor
 engine_name
 
 engine
 
- Public Attributes inherited from searx.search.processors.abstract.EngineProcessor
 engine = engine
 
 engine_name = engine_name
 
 logger = engines[engine_name].logger
 
 suspended_status = SUSPENDED_STATUS.setdefault(key, SuspendedStatus())
 

Static Public Attributes

str engine_type = 'online_dictionary'
 
- Static Public Attributes inherited from searx.search.processors.online.OnlineProcessor
str engine_type = 'online'
 

Additional Inherited Members

- Protected Member Functions inherited from searx.search.processors.online.OnlineProcessor
 _send_http_request (self, params)
 
 _search_basic (self, query, params)
 
- Protected Member Functions inherited from searx.search.processors.abstract.EngineProcessor
 _extend_container_basic (self, result_container, start_time, search_results)
 

Detailed Description

Processor class used by ``online_dictionary`` engines.

Definition at line 14 of file online_dictionary.py.

Member Function Documentation

◆ get_default_tests()

searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_default_tests ( self)

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

Definition at line 45 of file online_dictionary.py.

45 def get_default_tests(self):
46 tests = {}
47
48 if getattr(self.engine, 'paging', False):
49 tests['translation_paging'] = {
50 'matrix': {'query': 'en-es house', 'pageno': (1, 2, 3)},
51 'result_container': ['not_empty', ('one_title_contains', 'house')],
52 'test': ['unique_results'],
53 }
54 else:
55 tests['translation'] = {
56 'matrix': {'query': 'en-es house'},
57 'result_container': ['not_empty', ('one_title_contains', 'house')],
58 }
59
60 return tests

◆ get_params()

searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_params ( self,
search_query,
engine_category )
Returns a set of :ref:`request params <engine request online_dictionary>` or
``None`` if search query does not match to :py:obj:`parser_re`.

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

Definition at line 19 of file online_dictionary.py.

19 def get_params(self, search_query, engine_category):
20 """Returns a set of :ref:`request params <engine request online_dictionary>` or
21 ``None`` if search query does not match to :py:obj:`parser_re`.
22 """
23 params = super().get_params(search_query, engine_category)
24 if params is None:
25 return None
26
27 m = parser_re.match(search_query.query)
28 if not m:
29 return None
30
31 from_lang, to_lang, query = m.groups()
32
33 from_lang = is_valid_lang(from_lang)
34 to_lang = is_valid_lang(to_lang)
35
36 if not from_lang or not to_lang:
37 return None
38
39 params['from_lang'] = from_lang
40 params['to_lang'] = to_lang
41 params['query'] = query
42
43 return params
44

References searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_params().

Referenced by searx.search.processors.online_dictionary.OnlineDictionaryProcessor.get_params().

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

Member Data Documentation

◆ engine

◆ engine_type

str searx.search.processors.online_dictionary.OnlineDictionaryProcessor.engine_type = 'online_dictionary'
static

Definition at line 17 of file online_dictionary.py.


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