diff options
| author | Alexandre Flament <alex@al-f.net> | 2020-12-16 13:41:32 +0100 |
|---|---|---|
| committer | Alexandre Flament <alex@al-f.net> | 2020-12-17 11:39:36 +0100 |
| commit | 7ec8bc3ea76516e33318c67165161df5c1efdd36 (patch) | |
| tree | 6c9dff310882db816cada8662ef5ed2b8a8158e8 /searx/engines | |
| parent | c0cc01e936593ff3df828fa3bb834507c45cd7ac (diff) | |
[mod] split searx.search into different processors
see searx.search.processors.abstract.EngineProcessor
First the method searx call the get_params method.
If the return value is not None, then the searx call the method search.
Diffstat (limited to 'searx/engines')
| -rw-r--r-- | searx/engines/__init__.py | 10 | ||||
| -rw-r--r-- | searx/engines/command.py | 2 |
2 files changed, 7 insertions, 5 deletions
diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index b2a9b25a4..f2b7c5a84 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -53,7 +53,7 @@ engine_default_args = {'paging': False, 'suspend_end_time': 0, 'continuous_errors': 0, 'time_range_support': False, - 'offline': False, + 'engine_type': 'online', 'display_error_messages': True, 'tokens': []} @@ -142,7 +142,9 @@ def load_engine(engine_data): 'errors': 0 } - if not engine.offline: + engine_type = getattr(engine, 'engine_type', 'online') + + if engine_type != 'offline': engine.stats['page_load_time'] = 0 engine.stats['page_load_count'] = 0 @@ -209,7 +211,7 @@ def get_engines_stats(preferences): else: score = score_per_result = 0.0 - if not engine.offline: + if engine.engine_type != 'offline': load_times = 0 if engine.stats['page_load_count'] != 0: load_times = engine.stats['page_load_time'] / float(engine.stats['page_load_count']) # noqa @@ -300,7 +302,7 @@ def initialize_engines(engine_list): def _set_https_support_for_engine(engine): # check HTTPS support if it is not disabled - if not engine.offline and not hasattr(engine, 'https_support'): + if engine.engine_type != 'offline' and not hasattr(engine, 'https_support'): params = engine.request('http_test', { 'method': 'GET', 'headers': {}, diff --git a/searx/engines/command.py b/searx/engines/command.py index 0268d52eb..6321e0004 100644 --- a/searx/engines/command.py +++ b/searx/engines/command.py @@ -23,7 +23,7 @@ from threading import Thread from searx import logger -offline = True +engine_type = 'offline' paging = True command = [] delimiter = {} |