mirror of https://github.com/searx/searx
plugin infos
parent
db6820ec28
commit
0ad744ee97
3
Home.md
3
Home.md
|
@ -10,6 +10,7 @@
|
||||||
## developer documentation
|
## developer documentation
|
||||||
|
|
||||||
* [Translation guide](https://github.com/asciimoo/searx/wiki/Translation)
|
* [Translation guide](https://github.com/asciimoo/searx/wiki/Translation)
|
||||||
|
* [Plugins](https://github.com/asciimoo/searx/wiki/Plugins)
|
||||||
* [Compiling Styles](https://github.com/asciimoo/searx/wiki/Styles)
|
* [Compiling Styles](https://github.com/asciimoo/searx/wiki/Styles)
|
||||||
* [Compiling Javascripts](https://github.com/asciimoo/searx/wiki/Grunt-for-the-javascript-files)
|
* [Compiling Javascripts](https://github.com/asciimoo/searx/wiki/Grunt-for-the-javascript-files)
|
||||||
|
|
||||||
|
@ -19,4 +20,4 @@
|
||||||
|
|
||||||
#### brainstorming
|
#### brainstorming
|
||||||
* [Database structure](https://github.com/asciimoo/searx/wiki/database-structure)
|
* [Database structure](https://github.com/asciimoo/searx/wiki/database-structure)
|
||||||
* [Infoboxes brainstorming](https://github.com/asciimoo/searx/wiki/Infoboxes-brainstorming)
|
* [Infoboxes brainstorming](https://github.com/asciimoo/searx/wiki/Infoboxes-brainstorming)
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
## Plugins
|
||||||
|
|
||||||
|
Plugins can extend/replace functionality of various components inside searx.
|
||||||
|
|
||||||
|
### example_plugin.py
|
||||||
|
|
||||||
|
```python
|
||||||
|
name = 'Example plugin'
|
||||||
|
description = 'This plugin extends the suggestions with the word "example"'
|
||||||
|
default_on = False # disable by default
|
||||||
|
|
||||||
|
|
||||||
|
# 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):
|
||||||
|
ctx['search'].suggestions.add('example')
|
||||||
|
return True
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Currently implemented plugin entry points (a.k.a hooks)
|
||||||
|
|
||||||
|
* Pre search hook (`pre_search`)
|
||||||
|
* Post search hook (`post_search`)
|
||||||
|
|
||||||
|
Feel free to add more hooks to the code if it is required by a plugin.
|
||||||
|
|
||||||
|
|
||||||
|
### TODO
|
||||||
|
|
||||||
|
* Client side dependency handling
|
||||||
|
* Better documentation
|
||||||
|
* More hooks
|
Loading…
Reference in New Issue