Browse Source

better API docs && more features in list

Noemi Vanyi 8 years ago
parent
commit
18a8e609b3
4 changed files with 123 additions and 29 deletions
  1. 78
    0
      docs/admin/api.rst
  2. 17
    17
      docs/dev/plugins.rst
  3. 13
    6
      docs/dev/search_api.rst
  4. 15
    6
      docs/index.rst

+ 78
- 0
docs/admin/api.rst View File

1
+.. _adminapi:
2
+
3
+Administration API
4
+------------------
5
+
6
+Get configuration data
7
+~~~~~~~~~~~~~~~~~~~~~~
8
+
9
+.. code:: sh
10
+
11
+    GET /config
12
+
13
+Sample response
14
+```````````````
15
+
16
+.. code:: sh
17
+    
18
+    {
19
+      "autocomplete": "", 
20
+      "categories": [
21
+        "map", 
22
+        "it", 
23
+        "images", 
24
+      ], 
25
+      "default_locale": "", 
26
+      "default_theme": "oscar", 
27
+      "engines": [
28
+        {
29
+          "categories": [
30
+            "map"
31
+          ], 
32
+          "enabled": true, 
33
+          "name": "openstreetmap", 
34
+          "shortcut": "osm"
35
+        }, 
36
+        {
37
+          "categories": [
38
+            "it"
39
+          ], 
40
+          "enabled": true, 
41
+          "name": "arch linux wiki", 
42
+          "shortcut": "al"
43
+        }, 
44
+        {
45
+          "categories": [
46
+            "images"
47
+          ], 
48
+          "enabled": true, 
49
+          "name": "google images", 
50
+          "shortcut": "goi"
51
+        }, 
52
+        {
53
+          "categories": [
54
+            "it"
55
+          ], 
56
+          "enabled": false, 
57
+          "name": "bitbucket", 
58
+          "shortcut": "bb"
59
+        }, 
60
+      ], 
61
+      "instance_name": "searx", 
62
+      "locales": {
63
+        "de": "Deutsch (German)", 
64
+        "en": "English", 
65
+        "eo": "Esperanto (Esperanto)", 
66
+      }, 
67
+      "plugins": [
68
+        {
69
+          "enabled": true, 
70
+          "name": "HTTPS rewrite"
71
+        }, 
72
+        {
73
+          "enabled": false, 
74
+          "name": "Vim-like hotkeys"
75
+        }
76
+      ], 
77
+      "safe_search": 0
78
+    }

+ 17
- 17
docs/dev/plugins.rst View File

1
 Plugins
1
 Plugins
2
 -------
2
 -------
3
 
3
 
4
-Plugins can extend/replace functionality of various components inside
4
+Plugins can extend or replace functionality of various components of
5
 searx.
5
 searx.
6
 
6
 
7
-example\_plugin.py
8
-~~~~~~~~~~~~~~~~~~
7
+Example plugin
8
+~~~~~~~~~~~~~~
9
 
9
 
10
 .. code:: python
10
 .. code:: python
11
 
11
 
24
         ctx['search'].suggestions.add('example')
24
         ctx['search'].suggestions.add('example')
25
         return True
25
         return True
26
 
26
 
27
-Currently implemented plugin entry points (a.k.a hooks)
28
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27
+Plugin entry points
28
+~~~~~~~~~~~~~~~~~~~
29
 
29
 
30
--  Pre search hook (``pre_search``)
31
--  Post search hook (``post_search``)
32
--  Result hook (``on_result``) (is called if a new result is added (see
33
-   https\_rewrite plugin))
30
+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.
34
 
31
 
35
-Feel free to add more hooks to the code if it is required by a plugin.
32
+Pre search hook
33
+```````````````
36
 
34
 
37
-TODO
38
-~~~~
35
+Runs BEFORE the search request. Function to implement: ``pre_search``
39
 
36
 
40
--  Better documentation
41
--  More hooks
42
--  search hook (is called while searx is requesting results (for
43
-   example: things like math-solver), the different hooks are running
44
-   parallel)
37
+Post search hook
38
+````````````````
45
 
39
 
40
+Runs AFTER the search request. Function to implement: ``post_search``
41
+
42
+Result hook
43
+```````````
44
+
45
+Runs when a new result is added to the result list. Function to implement: ``on_result``

+ 13
- 6
docs/dev/search_api.rst View File

1
 Search API
1
 Search API
2
 ==========
2
 ==========
3
 
3
 
4
-Search API endpoints: ``/``, ``/search``
5
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
+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.
6
 
5
 
7
-Endpoints have equivalent functionality.
6
+Furthermore, two enpoints ``/`` and ``/search`` are available for querying.
7
+
8
+.. code:: sh
9
+
10
+    GET /
11
+
12
+.. code:: sh
13
+
14
+    GET /search
8
 
15
 
9
 Parameters
16
 Parameters
10
-^^^^^^^^^^
17
+``````````
11
 
18
 
12
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
19
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
13
 | Name             | Description                                                                                        |                             |
20
 | Name             | Description                                                                                        |                             |
18
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
25
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
19
 | ``engines``      | Comma separated list, specifies the active search engines                                          | optional                    |
26
 | ``engines``      | Comma separated list, specifies the active search engines                                          | optional                    |
20
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
27
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
28
+| ``lang``         | Code of the language                                                                               | optional (default: ``all``) |
29
++------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
21
 | ``pageno``       | Search page number                                                                                 | optional (default: ``1``)   |
30
 | ``pageno``       | Search page number                                                                                 | optional (default: ``1``)   |
22
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
31
 +------------------+----------------------------------------------------------------------------------------------------+-----------------------------+
23
-
24
-Both ``GET`` and ``POST`` methods are supported.

+ 15
- 6
docs/index.rst View File

1
-Privacy-respecting free metasearch engine
2
-=========================================
1
+Welcome to searx
2
+================
3
 
3
 
4
-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.
4
+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.
5
 
5
 
6
 
6
 
7
 Features
7
 Features
15
  - Does not collect its users data
15
  - Does not collect its users data
16
  - Offers secure, encrypted connections (HTTPS/SSL)
16
  - Offers secure, encrypted connections (HTTPS/SSL)
17
  - Hosted by organisations, such as La Quadrature du Net, which promote digital rights
17
  - Hosted by organisations, such as La Quadrature du Net, which promote digital rights
18
+ - About 70 supported search engines
19
+ - Easy intergration with any search engine
18
 
20
 
19
 
21
 
20
-Further reading
21
----------------
22
+User documentation
23
+------------------
22
 
24
 
23
 .. toctree::
25
 .. toctree::
24
    :maxdepth: 1
26
    :maxdepth: 1
25
 
27
 
26
    user/search_syntax
28
    user/search_syntax
27
 
29
 
30
+Administrator documentation
31
+---------------------------
32
+
33
+.. toctree::
34
+   :maxdepth: 1
35
+
36
+   dev/install/installation
37
+   admin/api
28
 
38
 
29
 Developer documentation
39
 Developer documentation
30
 -----------------------
40
 -----------------------
34
 
44
 
35
    dev/quickstart
45
    dev/quickstart
36
    dev/contribution_guide
46
    dev/contribution_guide
37
-   dev/install/installation
38
    dev/engine_overview
47
    dev/engine_overview
39
    dev/search_api
48
    dev/search_api
40
    dev/plugins
49
    dev/plugins