From 2ad8715b3282557d39da21721487ff85683b1219 Mon Sep 17 00:00:00 2001 From: Noemi Vanyi Date: Sat, 9 Jul 2016 22:31:21 +0200 Subject: [PATCH] better API docs && more features in list --- docs/admin/api.rst | 78 +++++++++++++++++++++++++++++++++++++++++ docs/dev/plugins.rst | 34 +++++++++--------- docs/dev/search_api.rst | 19 ++++++---- docs/index.rst | 21 +++++++---- 4 files changed, 123 insertions(+), 29 deletions(-) create mode 100644 docs/admin/api.rst diff --git a/docs/admin/api.rst b/docs/admin/api.rst new file mode 100644 index 000000000..94508a28c --- /dev/null +++ b/docs/admin/api.rst @@ -0,0 +1,78 @@ +.. _adminapi: + +Administration API +------------------ + +Get configuration data +~~~~~~~~~~~~~~~~~~~~~~ + +.. code:: sh + + GET /config + +Sample response +``````````````` + +.. code:: sh + + { + "autocomplete": "", + "categories": [ + "map", + "it", + "images", + ], + "default_locale": "", + "default_theme": "oscar", + "engines": [ + { + "categories": [ + "map" + ], + "enabled": true, + "name": "openstreetmap", + "shortcut": "osm" + }, + { + "categories": [ + "it" + ], + "enabled": true, + "name": "arch linux wiki", + "shortcut": "al" + }, + { + "categories": [ + "images" + ], + "enabled": true, + "name": "google images", + "shortcut": "goi" + }, + { + "categories": [ + "it" + ], + "enabled": false, + "name": "bitbucket", + "shortcut": "bb" + }, + ], + "instance_name": "searx", + "locales": { + "de": "Deutsch (German)", + "en": "English", + "eo": "Esperanto (Esperanto)", + }, + "plugins": [ + { + "enabled": true, + "name": "HTTPS rewrite" + }, + { + "enabled": false, + "name": "Vim-like hotkeys" + } + ], + "safe_search": 0 + } 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. diff --git a/docs/index.rst b/docs/index.rst index d6e21894b..c24eff4d2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,7 +1,7 @@ -Privacy-respecting free metasearch engine -========================================= +Welcome to searx +================ -Searx is a free software internet metasearch engine which aggregates results from other search engines, while not storing information about its users. Searx does not track or profile its users, nor does it share its users' data with third parties. Additionally, searx can be used over Tor for online anonymity. +Searx is a free software internet metasearch engine which aggregates results from more than 70 engines, while not storing information about its users. Searx does not track or profile its users, nor does it share its users' data with third parties. Additionally, searx can be used over Tor for online anonymity. Features @@ -15,16 +15,26 @@ Features - Does not collect its users data - Offers secure, encrypted connections (HTTPS/SSL) - Hosted by organisations, such as La Quadrature du Net, which promote digital rights + - About 70 supported search engines + - Easy intergration with any search engine -Further reading ---------------- +User documentation +------------------ .. toctree:: :maxdepth: 1 user/search_syntax +Administrator documentation +--------------------------- + +.. toctree:: + :maxdepth: 1 + + dev/install/installation + admin/api Developer documentation ----------------------- @@ -34,7 +44,6 @@ Developer documentation dev/quickstart dev/contribution_guide - dev/install/installation dev/engine_overview dev/search_api dev/plugins