diff options
| author | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-07-09 22:31:21 +0200 |
|---|---|---|
| committer | Noemi Vanyi <sitbackandwait@gmail.com> | 2016-07-09 22:31:21 +0200 |
| commit | 2ad8715b3282557d39da21721487ff85683b1219 (patch) | |
| tree | 5d40b42c696b7064e062fdbb2786211a6bf6a8c9 /docs/dev | |
| parent | 9f7cb4359ccc85d5b644dacc0745220700158b0b (diff) | |
better API docs && more features in list
Diffstat (limited to 'docs/dev')
| -rw-r--r-- | docs/dev/plugins.rst | 34 | ||||
| -rw-r--r-- | docs/dev/search_api.rst | 19 |
2 files changed, 30 insertions, 23 deletions
diff --git a/docs/dev/plugins.rst b/docs/dev/plugins.rst index c51fdf0eb..0f52af0d8 100644 --- a/docs/dev/plugins.rst +++ b/docs/dev/plugins.rst @@ -1,11 +1,11 @@ Plugins ------- -Plugins can extend/replace functionality of various components inside +Plugins can extend or replace functionality of various components of searx. -example\_plugin.py -~~~~~~~~~~~~~~~~~~ +Example plugin +~~~~~~~~~~~~~~ .. code:: python @@ -24,22 +24,22 @@ example\_plugin.py ctx['search'].suggestions.add('example') return True -Currently implemented plugin entry points (a.k.a hooks) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Plugin entry points +~~~~~~~~~~~~~~~~~~~ -- 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)) +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. -Feel free to add more hooks to the code if it is required by a plugin. +Pre search hook +``````````````` -TODO -~~~~ +Runs BEFORE the search request. Function to implement: ``pre_search`` -- 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) +Post search hook +```````````````` +Runs AFTER the search request. Function to implement: ``post_search`` + +Result hook +``````````` + +Runs when a new result is added to the result list. Function to implement: ``on_result`` diff --git a/docs/dev/search_api.rst b/docs/dev/search_api.rst index cd86fd71c..59d3c825f 100644 --- a/docs/dev/search_api.rst +++ b/docs/dev/search_api.rst @@ -1,13 +1,20 @@ Search API ========== -Search API endpoints: ``/``, ``/search`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The search supports both ``GET`` and ``POST``. However, using ``GET`` the parameters of the request remain hidden. So it is advised to use ``GET`` for querying. -Endpoints have equivalent functionality. +Furthermore, two enpoints ``/`` and ``/search`` are available for querying. + +.. code:: sh + + GET / + +.. code:: sh + + GET /search Parameters -^^^^^^^^^^ +`````````` +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+ | Name | Description | | @@ -18,7 +25,7 @@ Parameters +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+ | ``engines`` | Comma separated list, specifies the active search engines | optional | +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+ +| ``lang`` | Code of the language | optional (default: ``all``) | ++------------------+----------------------------------------------------------------------------------------------------+-----------------------------+ | ``pageno`` | Search page number | optional (default: ``1``) | +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+ - -Both ``GET`` and ``POST`` methods are supported. |