on 5bdca1a help sign in
searx/docs/dev/plugins.rst
48 lines 1.2 kB history raw
1=======
2Plugins
3=======
5Plugins can extend or replace functionality of various components of searx.
7Example plugin
8==============
10.. code:: python
12 name = 'Example plugin'
13 description = 'This plugin extends the suggestions with the word "example"'
14 default_on = False # disabled by default
16 js_dependencies = tuple() # optional, list of static js files
17 css_dependencies = tuple() # optional, list of static css files
20 # attach callback to the post search hook
21 # request: flask request object
22 # ctx: the whole local context of the post search hook
23 def post_search(request, ctx):
24 ctx['search'].suggestions.add('example')
25 return True
27Plugin entry points
28===================
30Entry points (hooks) define when a plugin runs. Right now only three hooks are
31implemented. So feel free to implement a hook if it fits the behaviour of your
32plugin.
34Pre search hook
35---------------
37Runs BEFORE the search request. Function to implement: ``pre_search``
39Post search hook
40----------------
42Runs AFTER the search request. Function to implement: ``post_search``
44Result hook
45-----------
47Runs when a new result is added to the result list. Function to implement:
48``on_result``