瀏覽代碼

Merge pull request #1067 from kvch/gh-pages

update search api with params and description on syntax
Adam Tauber 7 年之前
父節點
當前提交
92ab4167a0
共有 3 個檔案被更改,包括 305 行新增70 行删除
  1. 113
    47
      dev/search_api.html
  2. 191
    22
      docs/dev/search_api.rst
  3. 1
    1
      searchindex.js

+ 113
- 47
dev/search_api.html 查看文件

@@ -42,57 +42,123 @@
42 42
 <h1>Search API<a class="headerlink" href="#search-api" title="Permalink to this headline">¶</a></h1>
43 43
 <p>The search supports both <code class="docutils literal"><span class="pre">GET</span></code> and <code class="docutils literal"><span class="pre">POST</span></code>.</p>
44 44
 <p>Furthermore, two enpoints <code class="docutils literal"><span class="pre">/</span></code> and <code class="docutils literal"><span class="pre">/search</span></code> are available for querying.</p>
45
-<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">GET</span> <span class="o">/</span>
45
+<p><code class="docutils literal"><span class="pre">GET</span> <span class="pre">/</span></code></p>
46
+<p><code class="docutils literal"><span class="pre">GET</span> <span class="pre">/search</span></code></p>
47
+<div class="section" id="parameters">
48
+<h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2>
49
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">q</span>
46 50
 </pre></div>
47 51
 </div>
48
-<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">GET</span> <span class="o">/</span><span class="n">search</span>
52
+<p>The search query. This string is passed to external search services.
53
+Thus, searx supports syntax of each search service. For example, <code class="docutils literal"><span class="pre">site:github.com</span> <span class="pre">searx</span></code> is a valid
54
+query for Google. However, if simply the query above is passed to any search engine which does not filter its
55
+results based on this syntax, you might not get the results you wanted.</p>
56
+<p>See more at <a class="reference internal" href="../user/search_syntax.html"><span class="doc">Search syntax</span></a></p>
57
+<p>Required.</p>
58
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">categories</span>
49 59
 </pre></div>
50 60
 </div>
51
-<div class="section" id="parameters">
52
-<h2>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2>
53
-<table border="1" class="docutils">
54
-<colgroup>
55
-<col width="11%" />
56
-<col width="60%" />
57
-<col width="30%" />
58
-</colgroup>
59
-<thead valign="bottom">
60
-<tr class="row-odd"><th class="head">Name</th>
61
-<th class="head">Description</th>
62
-<th class="head">&#160;</th>
63
-</tr>
64
-</thead>
65
-<tbody valign="top">
66
-<tr class="row-even"><td><code class="docutils literal"><span class="pre">q</span></code></td>
67
-<td>The search query, see <a class="reference internal" href="../user/search_syntax.html"><span class="doc">Search syntax</span></a></td>
68
-<td>required</td>
69
-</tr>
70
-<tr class="row-odd"><td><code class="docutils literal"><span class="pre">categories</span></code></td>
71
-<td>Comma separated list, specifies the active search categories</td>
72
-<td>optional</td>
73
-</tr>
74
-<tr class="row-even"><td><code class="docutils literal"><span class="pre">engines</span></code></td>
75
-<td>Comma separated list, specifies the active search engines</td>
76
-<td>optional</td>
77
-</tr>
78
-<tr class="row-odd"><td><code class="docutils literal"><span class="pre">lang</span></code></td>
79
-<td>Code of the language</td>
80
-<td>optional (default: <code class="docutils literal"><span class="pre">all</span></code>)</td>
81
-</tr>
82
-<tr class="row-even"><td><code class="docutils literal"><span class="pre">pageno</span></code></td>
83
-<td>Search page number</td>
84
-<td>optional (default: <code class="docutils literal"><span class="pre">1</span></code>)</td>
85
-</tr>
86
-<tr class="row-odd"><td><code class="docutils literal"><span class="pre">time_range</span></code></td>
87
-<td>Time range of search</td>
88
-<td>optional (possible: <code class="docutils literal"><span class="pre">day</span></code>, <code class="docutils literal"><span class="pre">month</span></code>, <code class="docutils literal"><span class="pre">year</span></code>)</td>
89
-</tr>
90
-<tr class="row-even"><td><code class="docutils literal"><span class="pre">format</span></code></td>
91
-<td>Output format of results</td>
92
-<td>optional (possible: <code class="docutils literal"><span class="pre">json</span></code>, <code class="docutils literal"><span class="pre">csv</span></code>, <code class="docutils literal"><span class="pre">rss</span></code>)</td>
93
-</tr>
94
-</tbody>
95
-</table>
61
+<p>Comma separated list, specifies the active search categories</p>
62
+<p>Optional.</p>
63
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">engines</span>
64
+</pre></div>
65
+</div>
66
+<p>Comma separated list, specifies the active search engines.</p>
67
+<p>Optional.</p>
68
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">lang</span>
69
+</pre></div>
70
+</div>
71
+<p>Code of the language.</p>
72
+<p>Optional.</p>
73
+<p>Default: <code class="docutils literal"><span class="pre">all</span></code></p>
74
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">pageno</span>
75
+</pre></div>
76
+</div>
77
+<p>Search page number.</p>
78
+<p>Optional.</p>
79
+<p>Default: <code class="docutils literal"><span class="pre">1</span></code></p>
80
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">time_range</span>
81
+</pre></div>
82
+</div>
83
+<p>Time range of search for engines which support it. See if an engine supports time range search in the preferences page of an instance.</p>
84
+<p>Optional.</p>
85
+<p>Possible: <code class="docutils literal"><span class="pre">day</span></code>, <code class="docutils literal"><span class="pre">month</span></code>, <code class="docutils literal"><span class="pre">year</span></code></p>
86
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="nb">format</span>
87
+</pre></div>
88
+</div>
89
+<p>Output format of results.</p>
90
+<p>Optional.</p>
91
+<p>Possible: <code class="docutils literal"><span class="pre">json</span></code>, <code class="docutils literal"><span class="pre">csv</span></code>, <code class="docutils literal"><span class="pre">rss</span></code></p>
92
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">results_on_new_tab</span>
93
+</pre></div>
94
+</div>
95
+<p>Open search results on new tab.</p>
96
+<p>Optional.</p>
97
+<p>Default: <code class="docutils literal"><span class="pre">0</span></code></p>
98
+<p>Possible: <code class="docutils literal"><span class="pre">0</span></code>, <code class="docutils literal"><span class="pre">1</span></code></p>
99
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">image_proxy</span>
100
+</pre></div>
101
+</div>
102
+<p>Proxy image results through searx.</p>
103
+<p>Optional.</p>
104
+<p>Default: <code class="docutils literal"><span class="pre">False</span></code></p>
105
+<p>Possible: <code class="docutils literal"><span class="pre">True</span></code>, <code class="docutils literal"><span class="pre">False</span></code></p>
106
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">autocomplete</span>
107
+</pre></div>
108
+</div>
109
+<p>Service which completes words as you type.</p>
110
+<p>Optional.</p>
111
+<p>Default: empty</p>
112
+<p>Possible: <code class="docutils literal"><span class="pre">google</span></code>, <code class="docutils literal"><span class="pre">dbpedia</span></code>, <code class="docutils literal"><span class="pre">duckduckgo</span></code>, <code class="docutils literal"><span class="pre">startpage</span></code>, <code class="docutils literal"><span class="pre">wikipedia</span></code></p>
113
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">safesearch</span>
114
+</pre></div>
115
+</div>
116
+<p>Filter search results of engines which support safe search. See if an engine supports safe search in the preferences page of an instance.</p>
117
+<p>Optional.</p>
118
+<p>Default: <code class="docutils literal"><span class="pre">None</span></code></p>
119
+<p>Possible: <code class="docutils literal"><span class="pre">0</span></code>, <code class="docutils literal"><span class="pre">1</span></code>, <code class="docutils literal"><span class="pre">None</span></code></p>
120
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">theme</span>
121
+</pre></div>
122
+</div>
123
+<p>Theme of instance.</p>
124
+<p>Optional.</p>
125
+<p>Default: <code class="docutils literal"><span class="pre">oscar</span></code></p>
126
+<p>Possible: <code class="docutils literal"><span class="pre">oscar</span></code>, <code class="docutils literal"><span class="pre">simple</span></code>, <code class="docutils literal"><span class="pre">legacy</span></code>, <code class="docutils literal"><span class="pre">pix-art</span></code>, <code class="docutils literal"><span class="pre">courgette</span></code></p>
127
+<p>Please note, available themes depend on an instance. It is possible that an instance administrator deleted, created or renamed themes on his/her instance. See the available options in the preferences page of the instance.</p>
128
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">oscar</span><span class="o">-</span><span class="n">style</span>
129
+</pre></div>
130
+</div>
131
+<p>Style of Oscar theme. It is only parsed if the theme of an instance is <code class="docutils literal"><span class="pre">oscar</span></code>.</p>
132
+<p>Optional.</p>
133
+<p>Default: <code class="docutils literal"><span class="pre">logicodev</span></code></p>
134
+<p>Possible: <code class="docutils literal"><span class="pre">pointhi</span></code>, <code class="docutils literal"><span class="pre">logicodev</span></code></p>
135
+<p>Please note, available styles depend on an instance. It is possible that an instance administrator deleted, created or renamed styles on his/her instance. See the available options in the preferences page of the instance.</p>
136
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">enabled_plugins</span>
137
+</pre></div>
138
+</div>
139
+<p>List of enabled plugins.</p>
140
+<p>Optional.</p>
141
+<p>Default: <code class="docutils literal"><span class="pre">HTTPS_rewrite</span></code>, <code class="docutils literal"><span class="pre">Self_Informations</span></code>, <code class="docutils literal"><span class="pre">Search_on_category_select</span></code>, <code class="docutils literal"><span class="pre">Tracker_URL_remover</span></code></p>
142
+<p>Possible: <code class="docutils literal"><span class="pre">DOAI_rewrite</span></code>, <code class="docutils literal"><span class="pre">HTTPS_rewrite</span></code>, <code class="docutils literal"><span class="pre">Infinite_scroll</span></code>, <code class="docutils literal"><span class="pre">Vim-like_hotkeys</span></code>, <code class="docutils literal"><span class="pre">Self_Informations</span></code>, <code class="docutils literal"><span class="pre">Tracker_URL_remover</span></code>, <code class="docutils literal"><span class="pre">Search_on_category_select</span></code></p>
143
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">disabled_plugins</span>
144
+</pre></div>
145
+</div>
146
+<p>List of disabled plugins.</p>
147
+<p>Optional.</p>
148
+<p>Default: <code class="docutils literal"><span class="pre">DOAI_rewrite</span></code>, <code class="docutils literal"><span class="pre">Infinite_scroll</span></code>, <code class="docutils literal"><span class="pre">Vim-like_hotkeys</span></code></p>
149
+<p>Possible: <code class="docutils literal"><span class="pre">DOAI_rewrite</span></code>, <code class="docutils literal"><span class="pre">HTTPS_rewrite</span></code>, <code class="docutils literal"><span class="pre">Infinite_scroll</span></code>, <code class="docutils literal"><span class="pre">Vim-like_hotkeys</span></code>, <code class="docutils literal"><span class="pre">Self_Informations</span></code>, <code class="docutils literal"><span class="pre">Tracker_URL_remover</span></code>, <code class="docutils literal"><span class="pre">Search_on_category_select</span></code></p>
150
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">enabled_engines</span>
151
+</pre></div>
152
+</div>
153
+<p>List of enabled engines.</p>
154
+<p>Optional.</p>
155
+<p>Possible:  all engines</p>
156
+<div class="code sh highlight-default"><div class="highlight"><pre><span></span><span class="n">disabled_engines</span>
157
+</pre></div>
158
+</div>
159
+<p>List of disabled engines.</p>
160
+<p>Optional.</p>
161
+<p>Possible: all engines</p>
96 162
 </div>
97 163
 </div>
98 164
 

+ 191
- 22
docs/dev/search_api.rst 查看文件

@@ -5,31 +5,200 @@ The search supports both ``GET`` and ``POST``.
5 5
 
6 6
 Furthermore, two enpoints ``/`` and ``/search`` are available for querying.
7 7
 
8
+
9
+``GET /``
10
+
11
+``GET /search``
12
+
13
+Parameters
14
+~~~~~~~~~~
15
+
8 16
 .. code:: sh
9 17
 
10
-    GET /
18
+    q
19
+
20
+The search query. This string is passed to external search services.
21
+Thus, searx supports syntax of each search service. For example, ``site:github.com searx`` is a valid
22
+query for Google. However, if simply the query above is passed to any search engine which does not filter its
23
+results based on this syntax, you might not get the results you wanted.
24
+
25
+
26
+See more at :doc:`/user/search_syntax`
27
+
28
+Required.
11 29
 
12 30
 .. code:: sh
13 31
 
14
-    GET /search
32
+    categories
15 33
 
16
-Parameters
17
-``````````
18
-
19
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
20
-| Name             | Description                                                                                        |                                                  |
21
-+==================+====================================================================================================+==================================================+
22
-| ``q``            | The search query, see :doc:`/user/search_syntax`                                                   | required                                         |
23
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
24
-| ``categories``   | Comma separated list, specifies the active search categories                                       | optional                                         |
25
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
26
-| ``engines``      | Comma separated list, specifies the active search engines                                          | optional                                         |
27
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
28
-| ``lang``         | Code of the language                                                                               | optional (default: ``all``)                      |
29
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
30
-| ``pageno``       | Search page number                                                                                 | optional (default: ``1``)                        |
31
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
32
-| ``time_range``   | Time range of search                                                                               | optional (possible: ``day``, ``month``, ``year``)|
33
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
34
-| ``format``       | Output format of results                                                                           | optional (possible: ``json``, ``csv``, ``rss``)  |
35
-+------------------+----------------------------------------------------------------------------------------------------+--------------------------------------------------+
34
+Comma separated list, specifies the active search categories
35
+
36
+Optional.
37
+
38
+.. code:: sh
39
+
40
+    engines
41
+
42
+Comma separated list, specifies the active search engines.
43
+
44
+Optional.
45
+
46
+.. code:: sh
47
+
48
+    lang
49
+
50
+Code of the language.
51
+
52
+Optional.
53
+
54
+Default: ``all``
55
+
56
+.. code:: sh
57
+
58
+    pageno
59
+
60
+Search page number.
61
+
62
+Optional.
63
+
64
+Default: ``1``
65
+
66
+.. code:: sh
67
+
68
+    time_range
69
+
70
+Time range of search for engines which support it. See if an engine supports time range search in the preferences page of an instance.
71
+
72
+Optional.
73
+
74
+Possible: ``day``, ``month``, ``year``
75
+
76
+.. code:: sh
77
+
78
+    format
79
+
80
+Output format of results.
81
+
82
+Optional.
83
+
84
+Possible: ``json``, ``csv``, ``rss``
85
+
86
+.. code:: sh
87
+
88
+    results_on_new_tab
89
+
90
+Open search results on new tab.
91
+
92
+Optional.
93
+
94
+Default: ``0``
95
+
96
+Possible: ``0``, ``1``
97
+
98
+.. code:: sh
99
+
100
+    image_proxy
101
+
102
+Proxy image results through searx.
103
+
104
+Optional.
105
+
106
+Default: ``False``
107
+
108
+Possible: ``True``, ``False``
109
+
110
+.. code:: sh
111
+
112
+    autocomplete
113
+
114
+Service which completes words as you type.
115
+
116
+Optional.
117
+
118
+Default: empty
119
+
120
+Possible: ``google``, ``dbpedia``, ``duckduckgo``, ``startpage``, ``wikipedia``
121
+
122
+.. code:: sh
123
+
124
+    safesearch
125
+
126
+Filter search results of engines which support safe search. See if an engine supports safe search in the preferences page of an instance.
127
+
128
+Optional.
129
+
130
+Default: ``None``
131
+
132
+Possible: ``0``, ``1``, ``None``
133
+
134
+.. code:: sh
135
+
136
+    theme
137
+
138
+Theme of instance.
139
+
140
+Optional.
141
+
142
+Default: ``oscar``
143
+
144
+Possible: ``oscar``, ``simple``, ``legacy``, ``pix-art``, ``courgette``
145
+
146
+Please note, available themes depend on an instance. It is possible that an instance administrator deleted, created or renamed themes on his/her instance. See the available options in the preferences page of the instance.
147
+
148
+.. code:: sh
149
+
150
+    oscar-style
151
+
152
+Style of Oscar theme. It is only parsed if the theme of an instance is ``oscar``.
153
+
154
+Optional.
155
+
156
+Default: ``logicodev``
157
+
158
+Possible: ``pointhi``, ``logicodev``
159
+
160
+Please note, available styles depend on an instance. It is possible that an instance administrator deleted, created or renamed styles on his/her instance. See the available options in the preferences page of the instance.
161
+
162
+.. code:: sh
163
+
164
+    enabled_plugins
165
+
166
+List of enabled plugins.
167
+
168
+Optional.
169
+
170
+Default: ``HTTPS_rewrite``, ``Self_Informations``, ``Search_on_category_select``, ``Tracker_URL_remover``
171
+
172
+Possible: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``, ``Search_on_category_select``
173
+
174
+.. code:: sh
175
+
176
+    disabled_plugins
177
+
178
+List of disabled plugins.
179
+
180
+Optional.
181
+
182
+Default: ``DOAI_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys``
183
+
184
+Possible: ``DOAI_rewrite``, ``HTTPS_rewrite``, ``Infinite_scroll``, ``Vim-like_hotkeys``, ``Self_Informations``, ``Tracker_URL_remover``, ``Search_on_category_select``
185
+
186
+.. code:: sh
187
+
188
+    enabled_engines
189
+
190
+List of enabled engines.
191
+
192
+Optional.
193
+
194
+Possible:  all engines
195
+
196
+.. code:: sh
197
+
198
+    disabled_engines
199
+
200
+List of disabled engines.
201
+
202
+Optional.
203
+
204
+Possible: all engines

+ 1
- 1
searchindex.js
文件差異過大導致無法顯示
查看文件