.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.search.SearchWithPlugins Class Reference
+ Inheritance diagram for searx.search.SearchWithPlugins:
+ Collaboration diagram for searx.search.SearchWithPlugins:

Public Member Functions

 __init__ (self, SearchQuery search_query, ordered_plugin_list, flask.Request request)
 
ResultContainer search (self)
 
- Public Member Functions inherited from searx.search.Search
 search_external_bang (self)
 
 search_answerers (self)
 
 search_multiple_requests (self, requests)
 
 search_standard (self)
 

Public Attributes

 ordered_plugin_list = ordered_plugin_list
 
 request = request._get_current_object()
 
- Public Attributes inherited from searx.search.Search
 search_query = search_query
 
 result_container = ResultContainer()
 
 start_time = None
 
 actual_timeout = None
 

Protected Member Functions

 _on_result (self, result)
 
- Protected Member Functions inherited from searx.search.Search
 _get_requests (self)
 

Static Private Attributes

str __slots__ = 'ordered_plugin_list', 'request'
 

Detailed Description

Inherit from the Search class, add calls to the plugins.

Definition at line 184 of file __init__.py.

Constructor & Destructor Documentation

◆ __init__()

searx.search.SearchWithPlugins.__init__ ( self,
SearchQuery search_query,
ordered_plugin_list,
flask.Request request )
Initialize the Search

Reimplemented from searx.search.Search.

Definition at line 189 of file __init__.py.

189 def __init__(self, search_query: SearchQuery, ordered_plugin_list, request: flask.Request):
190 super().__init__(search_query)
191 self.ordered_plugin_list = ordered_plugin_list
192 self.result_container.on_result = self._on_result
193 # pylint: disable=line-too-long
194 # get the "real" request to use it outside the Flask context.
195 # see
196 # * https://github.com/pallets/flask/blob/d01d26e5210e3ee4cbbdef12f05c886e08e92852/src/flask/globals.py#L55
197 # * https://github.com/pallets/werkzeug/blob/3c5d3c9bd0d9ce64590f0af8997a38f3823b368d/src/werkzeug/local.py#L548-L559
198 # * https://werkzeug.palletsprojects.com/en/2.0.x/local/#werkzeug.local.LocalProxy._get_current_object
199 # pylint: enable=line-too-long
200 self.request = request._get_current_object()
201

Member Function Documentation

◆ _on_result()

searx.search.SearchWithPlugins._on_result ( self,
result )
protected

Definition at line 202 of file __init__.py.

202 def _on_result(self, result):
203 return plugins.call(self.ordered_plugin_list, 'on_result', self.request, self, result)
204

◆ search()

ResultContainer searx.search.SearchWithPlugins.search ( self)

Reimplemented from searx.search.Search.

Definition at line 205 of file __init__.py.

205 def search(self) -> ResultContainer:
206 if plugins.call(self.ordered_plugin_list, 'pre_search', self.request, self):
207 super().search()
208
209 plugins.call(self.ordered_plugin_list, 'post_search', self.request, self)
210
211 self.result_container.close()
212
213 return self.result_container

Member Data Documentation

◆ __slots__

str searx.search.SearchWithPlugins.__slots__ = 'ordered_plugin_list', 'request'
staticprivate

Definition at line 187 of file __init__.py.

◆ ordered_plugin_list

searx.search.SearchWithPlugins.ordered_plugin_list = ordered_plugin_list

Definition at line 191 of file __init__.py.

◆ request

searx.search.SearchWithPlugins.request = request._get_current_object()

Definition at line 200 of file __init__.py.


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