.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.search.processors Namespace Reference

Namespaces

namespace  abstract
 
namespace  offline
 
namespace  online
 
namespace  online_currency
 
namespace  online_dictionary
 
 

Functions

 get_processor_class (engine_type)
 
 get_processor (engine, engine_name)
 
 initialize_processor (processor)
 
 initialize (engine_list)
 

Variables

list __all__
 
 logger = logger.getChild('search.processors')
 
dict PROCESSORS = {}
 

Detailed Description

Implement request processors used by engine-types.

Function Documentation

◆ get_processor()

searx.search.processors.get_processor ( engine,
engine_name )
Return processor instance that fits to ``engine.engine.type``)

Definition at line 52 of file __init__.py.

52def get_processor(engine, engine_name):
53 """Return processor instance that fits to ``engine.engine.type``)"""
54 engine_type = getattr(engine, 'engine_type', 'online')
55 processor_class = get_processor_class(engine_type)
56 if processor_class:
57 return processor_class(engine, engine_name)
58 return None
59
60

References searx.search.processors.get_processor_class().

Referenced by searx.search.processors.initialize().

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

◆ get_processor_class()

searx.search.processors.get_processor_class ( engine_type)
Return processor class according to the ``engine_type``

Definition at line 38 of file __init__.py.

38def get_processor_class(engine_type):
39 """Return processor class according to the ``engine_type``"""
40 for c in [
41 OnlineProcessor,
42 OfflineProcessor,
43 OnlineDictionaryProcessor,
44 OnlineCurrencyProcessor,
45 OnlineUrlSearchProcessor,
46 ]:
47 if c.engine_type == engine_type:
48 return c
49 return None
50
51

Referenced by searx.search.processors.get_processor().

+ Here is the caller graph for this function:

◆ initialize()

searx.search.processors.initialize ( engine_list)
Initialize all engines and store a processor for each engine in :py:obj:`PROCESSORS`.

Definition at line 71 of file __init__.py.

71def initialize(engine_list):
72 """Initialize all engines and store a processor for each engine in :py:obj:`PROCESSORS`."""
73 for engine_data in engine_list:
74 engine_name = engine_data['name']
75 engine = engines.engines.get(engine_name)
76 if engine:
77 processor = get_processor(engine, engine_name)
78 initialize_processor(processor)
79 if processor is None:
80 engine.logger.error('Error get processor for engine %s', engine_name)
81 else:
82 PROCESSORS[engine_name] = processor

References searx.search.processors.get_processor(), and searx.search.processors.initialize_processor().

+ Here is the call graph for this function:

◆ initialize_processor()

searx.search.processors.initialize_processor ( processor)
Initialize one processor

Call the init function of the engine

Definition at line 61 of file __init__.py.

61def initialize_processor(processor):
62 """Initialize one processor
63
64 Call the init function of the engine
65 """
66 if processor.has_initialize_function:
67 t = threading.Thread(target=processor.initialize, daemon=True)
68 t.start()
69
70

Referenced by searx.search.processors.initialize().

+ Here is the caller graph for this function:

Variable Documentation

◆ __all__

list searx.search.processors.__all__
private
Initial value:
1= [
2 'EngineProcessor',
3 'OfflineProcessor',
4 'OnlineProcessor',
5 'OnlineDictionaryProcessor',
6 'OnlineCurrencyProcessor',
7 'OnlineUrlSearchProcessor',
8 'PROCESSORS',
9]

Definition at line 7 of file __init__.py.

◆ logger

searx.search.processors.logger = logger.getChild('search.processors')

Definition at line 30 of file __init__.py.

◆ PROCESSORS

dict searx.search.processors.PROCESSORS = {}

Definition at line 31 of file __init__.py.