mirror of
https://github.com/searxng/searxng.git
synced 2024-11-27 13:21:04 +00:00
1.2 KiB
1.2 KiB
Plugins
Plugins can extend/replace functionality of various components inside searx.
example_plugin.py
= 'Example plugin'
name = 'This plugin extends the suggestions with the word "example"'
description = False # disable by default
default_on
= tuple() # optional, list of static js files
js_dependencies = tuple() # optional, list of static css files
css_dependencies
# attach callback to the post search hook
# request: flask request object
# ctx: the whole local context of the post search hook
def post_search(request, ctx):
'search'].suggestions.add('example')
ctx[return True
Currently implemented plugin entry points (a.k.a hooks)
- Pre search hook (
pre_search
) - Post search hook (
post_search
) - Result hook (
on_result
) (is called if a new result is added (see https_rewrite plugin))
Feel free to add more hooks to the code if it is required by a plugin.
TODO
- Better documentation
- More hooks
- search hook (is called while searx is requesting results (for example: things like math-solver), the different hooks are running parallel)