2017-06-12 12:34:30 +02:00
2019-12-30 18:31:17 +01:00
<!DOCTYPE html>
2015-11-17 23:38:25 +01:00
2020-06-19 11:15:15 +02:00
< html >
2015-11-17 23:38:25 +01:00
< head >
2019-12-30 18:31:17 +01:00
< meta charset = "utf-8" / >
2020-09-30 10:35:05 +02:00
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" / >
2019-12-30 18:31:17 +01:00
< meta name = "viewport" content = "width=device-width, initial-scale=1" >
2020-12-14 19:16:25 +01:00
< title > Plugins — Searx Documentation (Searx-0.18.0.tex)< / title >
2015-11-17 23:38:25 +01:00
< link rel = "stylesheet" href = "../_static/pygments.css" type = "text/css" / >
2021-01-05 16:45:49 +01:00
< link rel = "stylesheet" href = "../_static/searx.css" type = "text/css" / >
2020-09-30 10:35:05 +02:00
< link rel = "stylesheet" type = "text/css" href = "../_static/sphinx_tabs/semantic-ui-2.4.1/segment.min.css" / >
< link rel = "stylesheet" type = "text/css" href = "../_static/sphinx_tabs/semantic-ui-2.4.1/menu.min.css" / >
< link rel = "stylesheet" type = "text/css" href = "../_static/sphinx_tabs/semantic-ui-2.4.1/tab.min.css" / >
< link rel = "stylesheet" type = "text/css" href = "../_static/sphinx_tabs/tabs.css" / >
2020-02-15 10:08:58 +01:00
< script id = "documentation_options" data-url_root = "../" src = "../_static/documentation_options.js" > < / script >
< script src = "../_static/jquery.js" > < / script >
< script src = "../_static/underscore.js" > < / script >
< script src = "../_static/doctools.js" > < / script >
2016-11-04 21:56:14 +01:00
< link rel = "index" title = "Index" href = "../genindex.html" / >
< link rel = "search" title = "Search" href = "../search.html" / >
2015-11-17 23:38:25 +01:00
< link rel = "next" title = "Translation" href = "translation.html" / >
< link rel = "prev" title = "Search API" href = "search_api.html" / >
2019-12-30 18:31:17 +01:00
< script > DOCUMENTATION _OPTIONS . URL _ROOT = '../' ; < / script >
2015-11-17 23:38:25 +01:00
2019-12-30 18:31:17 +01:00
< / head > < body >
< div class = "related" role = "navigation" aria-label = "related navigation" >
< h3 > Navigation< / h3 >
< ul >
< li class = "right" style = "margin-right: 10px" >
< a href = "../genindex.html" title = "General Index"
accesskey="I">index< / a > < / li >
2020-11-04 14:12:59 +01:00
< li class = "right" >
< a href = "../py-modindex.html" title = "Python Module Index"
>modules< / a > |< / li >
2019-12-30 18:31:17 +01:00
< li class = "right" >
< a href = "translation.html" title = "Translation"
accesskey="N">next< / a > |< / li >
< li class = "right" >
< a href = "search_api.html" title = "Search API"
accesskey="P">previous< / a > |< / li >
2020-12-14 19:16:25 +01:00
< li class = "nav-item nav-item-0" > < a href = "../index.html" > Searx Documentation (Searx-0.18.0.tex)< / a > » < / li >
2020-09-30 10:35:05 +02:00
< li class = "nav-item nav-item-1" > < a href = "index.html" accesskey = "U" > Developer documentation< / a > » < / li >
< li class = "nav-item nav-item-this" > < a href = "" > Plugins< / a > < / li >
2019-12-30 18:31:17 +01:00
< / ul >
< / div >
2015-11-17 23:38:25 +01:00
< div class = "document" >
< div class = "documentwrapper" >
< div class = "bodywrapper" >
< div class = "body" role = "main" >
< div class = "section" id = "plugins" >
2019-12-30 18:31:17 +01:00
< span id = "dev-plugin" > < / span > < h1 > Plugins< a class = "headerlink" href = "#plugins" title = "Permalink to this headline" > ¶< / a > < / h1 >
< div class = "sidebar" >
< p class = "sidebar-title" > Further reading ..< / p >
< ul class = "simple" >
< li > < p > < a class = "reference internal" href = "../admin/plugins.html#plugins-generic" > < span class = "std std-ref" > Plugins builtin< / span > < / a > < / p > < / li >
< / ul >
< / div >
< p > Plugins can extend or replace functionality of various components of searx.< / p >
2016-07-09 22:32:57 +02:00
< div class = "section" id = "example-plugin" >
< h2 > Example plugin< a class = "headerlink" href = "#example-plugin" title = "Permalink to this headline" > ¶< / a > < / h2 >
2019-12-30 18:31:17 +01:00
< div class = "highlight-python notranslate" > < div class = "highlight" > < pre > < span > < / span > < span class = "n" > name< / span > < span class = "o" > =< / span > < span class = "s1" > ' Example plugin' < / span >
2016-11-04 21:56:14 +01:00
< span class = "n" > description< / span > < span class = "o" > =< / span > < span class = "s1" > ' This plugin extends the suggestions with the word " example" ' < / span >
2019-12-30 18:31:17 +01:00
< span class = "n" > default_on< / span > < span class = "o" > =< / span > < span class = "bp" > False< / span > < span class = "c1" > # disabled by default< / span >
2015-11-17 23:38:25 +01:00
2016-11-04 21:56:14 +01:00
< span class = "n" > js_dependencies< / span > < span class = "o" > =< / span > < span class = "nb" > tuple< / span > < span class = "p" > ()< / span > < span class = "c1" > # optional, list of static js files< / span >
< span class = "n" > css_dependencies< / span > < span class = "o" > =< / span > < span class = "nb" > tuple< / span > < span class = "p" > ()< / span > < span class = "c1" > # optional, list of static css files< / span >
2015-11-17 23:38:25 +01:00
2016-11-04 21:56:14 +01:00
< span class = "c1" > # attach callback to the post search hook< / span >
< span class = "c1" > # request: flask request object< / span >
< span class = "c1" > # ctx: the whole local context of the post search hook< / span >
2015-11-17 23:38:25 +01:00
< span class = "k" > def< / span > < span class = "nf" > post_search< / span > < span class = "p" > (< / span > < span class = "n" > request< / span > < span class = "p" > ,< / span > < span class = "n" > ctx< / span > < span class = "p" > ):< / span >
2016-11-04 21:56:14 +01:00
< span class = "n" > ctx< / span > < span class = "p" > [< / span > < span class = "s1" > ' search' < / span > < span class = "p" > ]< / span > < span class = "o" > .< / span > < span class = "n" > suggestions< / span > < span class = "o" > .< / span > < span class = "n" > add< / span > < span class = "p" > (< / span > < span class = "s1" > ' example' < / span > < span class = "p" > )< / span >
2019-12-30 18:31:17 +01:00
< span class = "k" > return< / span > < span class = "bp" > True< / span >
2015-11-17 23:38:25 +01:00
< / pre > < / div >
< / div >
< / div >
2020-09-02 00:33:07 +02:00
< div class = "section" id = "external-plugins" >
< h2 > External plugins< a class = "headerlink" href = "#external-plugins" title = "Permalink to this headline" > ¶< / a > < / h2 >
< p > External plugins are standard python modules implementing all the requirements of the standard plugins.
Plugins can be enabled by adding them to < a class = "reference internal" href = "../admin/settings.html#settings-yml" > < span class = "std std-ref" > settings.yml< / span > < / a > ’ s < code class = "docutils literal notranslate" > < span class = "pre" > plugins< / span > < / code > section.
Example external plugin can be found < a class = "reference external" href = "https://github.com/asciimoo/searx_external_plugin_example" > here< / a > .< / p >
< / div >
2020-07-25 18:33:36 +02:00
< div class = "section" id = "register-your-plugin" >
< h2 > Register your plugin< a class = "headerlink" href = "#register-your-plugin" title = "Permalink to this headline" > ¶< / a > < / h2 >
< p > To enable your plugin register your plugin in
searx > plugin > __init__.py.
And at the bottom of the file add your plugin like.
< code class = "docutils literal notranslate" > < span class = "pre" > plugins.register(name_of_python_file)< / span > < / code > < / p >
< / div >
2016-07-09 22:32:57 +02:00
< div class = "section" id = "plugin-entry-points" >
< h2 > Plugin entry points< a class = "headerlink" href = "#plugin-entry-points" title = "Permalink to this headline" > ¶< / a > < / h2 >
2019-12-30 18:31:17 +01:00
< p > Entry points (hooks) define when a plugin runs. Right now only three hooks are
implemented. So feel free to implement a hook if it fits the behaviour of your
plugin.< / p >
2016-07-09 22:32:57 +02:00
< div class = "section" id = "pre-search-hook" >
< h3 > Pre search hook< a class = "headerlink" href = "#pre-search-hook" title = "Permalink to this headline" > ¶< / a > < / h3 >
2019-12-30 18:31:17 +01:00
< p > Runs BEFORE the search request. Function to implement: < code class = "docutils literal notranslate" > < span class = "pre" > pre_search< / span > < / code > < / p >
2016-07-09 22:32:57 +02:00
< / div >
< div class = "section" id = "post-search-hook" >
< h3 > Post search hook< a class = "headerlink" href = "#post-search-hook" title = "Permalink to this headline" > ¶< / a > < / h3 >
2019-12-30 18:31:17 +01:00
< p > Runs AFTER the search request. Function to implement: < code class = "docutils literal notranslate" > < span class = "pre" > post_search< / span > < / code > < / p >
2016-07-09 22:32:57 +02:00
< / div >
< div class = "section" id = "result-hook" >
< h3 > Result hook< a class = "headerlink" href = "#result-hook" title = "Permalink to this headline" > ¶< / a > < / h3 >
2019-12-30 18:31:17 +01:00
< p > Runs when a new result is added to the result list. Function to implement:
< code class = "docutils literal notranslate" > < span class = "pre" > on_result< / span > < / code > < / p >
2015-11-17 23:38:25 +01:00
< / div >
< / div >
< / div >
2020-09-30 10:35:05 +02:00
< div class = "clearer" > < / div >
2015-11-17 23:38:25 +01:00
< / div >
< / div >
< / div >
2019-12-30 18:31:17 +01:00
< span id = "sidebar-top" > < / span >
2015-11-17 23:38:25 +01:00
< div class = "sphinxsidebar" role = "navigation" aria-label = "main navigation" >
2019-12-30 18:31:17 +01:00
< div class = "sphinxsidebarwrapper" >
< p class = "logo" > < a href = "../index.html" >
< img class = "logo" src = "../_static/searx_logo_small.png" alt = "Logo" / >
< / a > < / p >
< h3 > Project Links< / h3 >
< ul >
2020-09-30 10:35:05 +02:00
< li > < a href = "https://github.com/searx/searx" > Source< / a >
2019-12-30 18:31:17 +01:00
2020-09-30 10:35:05 +02:00
< li > < a href = "https://github.com/searx/searx/wiki" > Wiki< / a >
2019-12-30 18:31:17 +01:00
2021-01-12 10:55:12 +01:00
< li > < a href = "https://searx.space" > Public instances< / a >
2019-12-30 18:31:17 +01:00
< li > < a href = "https://twitter.com/Searx_engine" > Twitter< / a >
2021-01-12 10:55:12 +01:00
< li > < a href = "https://github.com/searx/searx/issues" > Issue Tracker< / a >
2019-12-30 18:31:17 +01:00
< / ul > < h3 > Navigation< / h3 >
2015-11-17 23:38:25 +01:00
< ul >
2019-12-30 18:31:17 +01:00
< li > < a href = "../index.html" > Overview< / a >
< ul >
< li > < a href = "index.html" > Developer documentation< / a >
< ul >
< li > Previous: < a href = "search_api.html" title = "previous chapter" > Search API< / a >
< li > Next: < a href = "translation.html" title = "next chapter" > Translation< / a > < / ul >
< / li >
< / ul >
< / li >
2015-11-17 23:38:25 +01:00
< / ul >
2019-12-30 18:31:17 +01:00
< div id = "searchbox" style = "display: none" role = "search" >
< h3 id = "searchlabel" > Quick search< / h3 >
< div class = "searchformwrapper" >
< form class = "search" action = "../search.html" method = "get" >
< input type = "text" name = "q" aria-labelledby = "searchlabel" / >
< input type = "submit" value = "Go" / >
< / form >
< / div >
2015-11-17 23:38:25 +01:00
< / div >
2020-02-15 10:08:58 +01:00
< script > $ ( '#searchbox' ) . show ( 0 ) ; < / script >
2015-11-17 23:38:25 +01:00
< / div >
< / div >
< div class = "clearer" > < / div >
< / div >
2019-12-30 18:31:17 +01:00
< div class = "footer" role = "contentinfo" >
2020-02-20 19:32:55 +01:00
© Copyright 2015-2020, Adam Tauber, Noémi Ványi.
2021-01-05 16:45:49 +01:00
Created using < a href = "https://www.sphinx-doc.org/" > Sphinx< / a > 3.4.1.
2015-11-17 23:38:25 +01:00
< / div >
2020-02-15 10:08:58 +01:00
< script src = "../_static/version_warning_offset.js" > < / script >
2019-12-30 18:31:17 +01:00
2015-11-17 23:38:25 +01:00
< / body >
< / html >