diff options
Diffstat (limited to 'searx')
-rw-r--r-- | searx/plugins/__init__.py | 4 | ||||
-rw-r--r-- | searx/search.py | 9 | ||||
-rw-r--r-- | searx/webapp.py | 2 |
3 files changed, 8 insertions, 7 deletions
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 768a510af..011d36260 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -63,9 +63,9 @@ class PluginStore(): plugin.id = plugin.name.replace(' ', '_') self.plugins.append(plugin) - def call(self, plugin_type, request, *args, **kwargs): + def call(self, ordered_plugin_list, plugin_type, request, *args, **kwargs): ret = True - for plugin in request.user_plugins: + for plugin in ordered_plugin_list: if hasattr(plugin, plugin_type): ret = getattr(plugin, plugin_type)(request, *args, **kwargs) if not ret: diff --git a/searx/search.py b/searx/search.py index e0f0cfd6a..0159d45b8 100644 --- a/searx/search.py +++ b/searx/search.py @@ -395,19 +395,20 @@ class SearchWithPlugins(Search): """Similar to the Search class but call the plugins.""" - def __init__(self, search_query, request): + def __init__(self, search_query, ordered_plugin_list, request): super(SearchWithPlugins, self).__init__(search_query) + self.ordered_plugin_list = ordered_plugin_list self.request = request def search(self): - if plugins.call('pre_search', self.request, self): + if plugins.call(self.ordered_plugin_list, 'pre_search', self.request, self): super(SearchWithPlugins, self).search() - plugins.call('post_search', self.request, self) + plugins.call(self.ordered_plugin_list, 'post_search', self.request, self) results = self.result_container.get_ordered_results() for result in results: - plugins.call('on_result', self.request, self, result) + plugins.call(self.ordered_plugin_list, 'on_result', self.request, self, result) return self.result_container diff --git a/searx/webapp.py b/searx/webapp.py index 4fee6e588..58f9815f9 100644 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -419,7 +419,7 @@ def index(): try: search_query = get_search_query_from_webapp(request.preferences, request.form) # search = Search(search_query) # without plugins - search = SearchWithPlugins(search_query, request) + search = SearchWithPlugins(search_query, request.user_plugins, request) result_container = search.search() except: request.errors.append(gettext('search error')) |