mirror of
https://github.com/searxng/searxng.git
synced 2024-11-23 04:27:46 +01:00
924f9afea3
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
31 lines
1.0 KiB
Python
31 lines
1.0 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
# lint: pylint
|
|
|
|
"""Processores for engine-type: ``offline``
|
|
|
|
"""
|
|
|
|
from searx import logger
|
|
from .abstract import EngineProcessor
|
|
|
|
logger = logger.getChild('searx.search.processor.offline')
|
|
|
|
class OfflineProcessor(EngineProcessor):
|
|
"""Processor class used by ``offline`` engines"""
|
|
|
|
engine_type = 'offline'
|
|
|
|
def _search_basic(self, query, params):
|
|
return self.engine.search(query, params)
|
|
|
|
def search(self, query, params, result_container, start_time, timeout_limit):
|
|
try:
|
|
search_results = self._search_basic(query, params)
|
|
self.extend_container(result_container, start_time, search_results)
|
|
except ValueError as e:
|
|
# do not record the error
|
|
logger.exception('engine {0} : invalid input : {1}'.format(self.engine_name, e))
|
|
except Exception as e: # pylint: disable=broad-except
|
|
self.handle_exception(result_container, e)
|
|
logger.exception('engine {0} : exception : {1}'.format(self.engine_name, e))
|