Procházet zdrojové kódy

[doc] engines overview added

Adam Tauber před 9 roky
rodič
revize
4af0e52e94

+ 314
- 0
_sources/dev/engine_overview.txt Zobrazit soubor

@@ -0,0 +1,314 @@
1
+Engine overview
2
+===============
3
+
4
+
5
+searx is a `metasearch-engine <https://en.wikipedia.org/wiki/Metasearch_engine>`__,
6
+so it is using different search engines to provide better results.
7
+
8
+Because there is no general search-api which can be used for every
9
+search-engine, there must be build an adapter between searx and the
10
+external search-engine. This adapters are stored in the folder
11
+`*searx/engines* <https://github.com/asciimoo/searx/tree/master/searx/engines>`__,
12
+and this site is build to make an general documentation about this
13
+engines
14
+
15
+
16
+.. contents::
17
+   :depth: 3
18
+
19
+general engine configuration
20
+----------------------------
21
+
22
+It is required to tell searx what results can the engine provide. The
23
+arguments can be inserted in the engine file, or in the settings file
24
+(normally ``settings.yml``). The arguments in the settings file override
25
+the one in the engine file.
26
+
27
+Really, it is for most options no difference if there are contained in
28
+the engine-file or in the settings. But there is a standard where to
29
+place specific arguments by default.
30
+
31
+
32
+engine-file
33
+~~~~~~~~~~~
34
+
35
++---------------------+-----------+-----------------------------------------+
36
+| argument            | type      | information                             |
37
++=====================+===========+=========================================+
38
+| categories          | list      | pages, in which the engine is working   |
39
++---------------------+-----------+-----------------------------------------+
40
+| paging              | boolean   | support multible pages                  |
41
++---------------------+-----------+-----------------------------------------+
42
+| language\_support   | boolean   | support language choosing               |
43
++---------------------+-----------+-----------------------------------------+
44
+
45
+settings.yml
46
+~~~~~~~~~~~~
47
+
48
++------------+----------+-----------------------------------------------+
49
+| argument   | type     | information                                   |
50
++============+==========+===============================================+
51
+| name       | string   | name of search-engine                         |
52
++------------+----------+-----------------------------------------------+
53
+| engine     | string   | name of searx-engine (filename without .py)   |
54
++------------+----------+-----------------------------------------------+
55
+| shortcut   | string   | shortcut of search-engine                     |
56
++------------+----------+-----------------------------------------------+
57
+| timeout    | string   | specific timeout for search-engine            |
58
++------------+----------+-----------------------------------------------+
59
+
60
+overrides
61
+~~~~~~~~~
62
+
63
+There are some options, with have default values in the engine, but are
64
+often overwritten by the settings. If the option is assigned in the
65
+engine-file with ``None`` it has to be redefined in the settings,
66
+otherwise searx is not starting with that engine.
67
+
68
+The naming of that overrides can be wathever you want. But we recommend
69
+the using of already used overrides if possible:
70
+
71
++-----------------------+----------+--------------------------------------------------------------+
72
+| argument              | type     | information                                                  |
73
++=======================+==========+==============================================================+
74
+| base\_url             | string   | base-url, can be overwrite to use same engine on other url   |
75
++-----------------------+----------+--------------------------------------------------------------+
76
+| number\_of\_results   | int      | maximum number of results per request                        |
77
++-----------------------+----------+--------------------------------------------------------------+
78
+| language              | string   | ISO code of language and country like en\_US                 |
79
++-----------------------+----------+--------------------------------------------------------------+
80
+| api\_key              | string   | api-key if required by engine                                |
81
++-----------------------+----------+--------------------------------------------------------------+
82
+
83
+example-code
84
+~~~~~~~~~~~~
85
+
86
+.. code:: python
87
+
88
+    # engine dependent config
89
+    categories = ['general']
90
+    paging = True
91
+    language_support = True
92
+
93
+doing request
94
+-------------
95
+
96
+To perform a search you have to specific at least a url on which the
97
+request is performing
98
+
99
+passed arguments
100
+~~~~~~~~~~~~~~~~
101
+
102
+This arguments can be used to calculate the search-query. Furthermore,
103
+some of that parameters are filled with default values which can be
104
+changed for special purpose.
105
+
106
++----------------------+------------+------------------------------------------------------------------------+
107
+| argument             | type       | default-value, informations                                            |
108
++======================+============+========================================================================+
109
+| url                  | string     | ``''``                                                                 |
110
++----------------------+------------+------------------------------------------------------------------------+
111
+| method               | string     | ``'GET'``                                                              |
112
++----------------------+------------+------------------------------------------------------------------------+
113
+| headers              | set        | ``{}``                                                                 |
114
++----------------------+------------+------------------------------------------------------------------------+
115
+| data                 | set        | ``{}``                                                                 |
116
++----------------------+------------+------------------------------------------------------------------------+
117
+| cookies              | set        | ``{}``                                                                 |
118
++----------------------+------------+------------------------------------------------------------------------+
119
+| verify               | boolean    | ``True``                                                               |
120
++----------------------+------------+------------------------------------------------------------------------+
121
+| headers.User-Agent   | string     | a random User-Agent                                                    |
122
++----------------------+------------+------------------------------------------------------------------------+
123
+| category             | string     | current category, like ``'general'``                                   |
124
++----------------------+------------+------------------------------------------------------------------------+
125
+| started              | datetime   | current date-time                                                      |
126
++----------------------+------------+------------------------------------------------------------------------+
127
+| pageno               | int        | current pagenumber                                                     |
128
++----------------------+------------+------------------------------------------------------------------------+
129
+| language             | string     | specific language code like ``'en_US'``, or ``'all'`` if unspecified   |
130
++----------------------+------------+------------------------------------------------------------------------+
131
+
132
+parsed arguments
133
+~~~~~~~~~~~~~~~~
134
+
135
+The function ``def request(query, params):`` is always returning the
136
+``params`` variable back. Inside searx, the following paramters can be
137
+used to specific a search-request:
138
+
139
++------------+-----------+----------------------------------------------------------+
140
+| argument   | type      | information                                              |
141
++============+===========+==========================================================+
142
+| url        | string    | requested url                                            |
143
++------------+-----------+----------------------------------------------------------+
144
+| method     | string    | HTTP request methode                                     |
145
++------------+-----------+----------------------------------------------------------+
146
+| headers    | set       | HTTP header informations                                 |
147
++------------+-----------+----------------------------------------------------------+
148
+| data       | set       | HTTP data informations (parsed if ``method != 'GET'``)   |
149
++------------+-----------+----------------------------------------------------------+
150
+| cookies    | set       | HTTP cookies                                             |
151
++------------+-----------+----------------------------------------------------------+
152
+| verify     | boolean   | Performing SSL-Validity check                            |
153
++------------+-----------+----------------------------------------------------------+
154
+
155
+example-code
156
+~~~~~~~~~~~~
157
+
158
+.. code:: python
159
+
160
+    # search-url
161
+    base_url = 'https://example.com/'
162
+    search_string = 'search?{query}&page={page}'
163
+
164
+    # do search-request
165
+    def request(query, params):
166
+        search_path = search_string.format(
167
+            query=urlencode({'q': query}),
168
+            page=params['pageno'])
169
+
170
+        params['url'] = base_url + search_path
171
+
172
+        return params
173
+
174
+returning results
175
+-----------------
176
+
177
+Searx has the possiblity to return results in different media-types.
178
+Currently the following media-types are supported:
179
+
180
+-  default
181
+-  images
182
+-  videos
183
+-  torrent
184
+-  map
185
+
186
+to set another media-type as default, you must set the parameter
187
+``template`` to the required type.
188
+
189
+default
190
+~~~~~~~
191
+
192
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
193
+| result-parameter   | information                                                                                                                        |
194
++====================+====================================================================================================================================+
195
+| url                | string, which is representing the url of the result                                                                                |
196
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
197
+| title              | string, which is representing the title of the result                                                                              |
198
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
199
+| content            | string, which is giving a general result-text                                                                                      |
200
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
201
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
202
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
203
+
204
+images
205
+~~~~~~
206
+
207
+to use this template, the parameter
208
+
209
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
210
+| result-parameter   | information                                                                                                                                               |
211
++====================+===========================================================================================================================================================+
212
+| template           | is set to ``images.html``                                                                                                                                 |
213
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
214
+| url                | string, which is representing the url to the result site                                                                                                  |
215
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
216
+| title              | string, which is representing the title of the result *(partly implemented)*                                                                              |
217
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
218
+| content            | *(partly implemented)*                                                                                                                                    |
219
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
220
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published *(partly implemented)*   |
221
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
222
+| img\_src           | string, which is representing the url to the result image                                                                                                 |
223
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
224
+| thumbnail\_src     | string, which is representing the url to a small-preview image                                                                                            |
225
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
226
+
227
+videos
228
+~~~~~~
229
+
230
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
231
+| result-parameter   | information                                                                                                                        |
232
++====================+====================================================================================================================================+
233
+| template           | is set to ``videos.html``                                                                                                          |
234
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
235
+| url                | string, which is representing the url of the result                                                                                |
236
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
237
+| title              | string, which is representing the title of the result                                                                              |
238
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
239
+| content            | *(not implemented yet)*                                                                                                            |
240
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
241
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
242
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
243
+| thumbnail          | string, which is representing the url to a small-preview image                                                                     |
244
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
245
+
246
+torrent
247
+~~~~~~~
248
+
249
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
250
+| result-parameter | information                                                                                                                                           |
251
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
252
+| template         | is set to ```torrent.html```                                                                                                                          |
253
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
254
+| url              | string, which is representing the url of the result                                                                                                   |
255
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
256
+| title            | string, which is representing the title of the result                                                                                                 |
257
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
258
+| content          | string, which is giving a general result-text                                                                                                         |
259
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
260
+| publishedDate    | [datetime.datetime](https://docs.python.org/2/library/datetime.html#datetime-objects), represent when the result is published _(not implemented yet)_ |
261
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
262
+| seed             | int, number of seeder                                                                                                                                 |
263
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
264
+| leech            | int, number of leecher                                                                                                                                |
265
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
266
+| filesize         | int, size of file in bytes                                                                                                                            |
267
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
268
+| files            | int, number of files                                                                                                                                  |
269
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
270
+| magnetlink       | string, which is the [magnetlink](https://en.wikipedia.org/wiki/Magnet_URI_scheme) of the result                                                      |
271
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
272
+| torrentfile      | string, which is the torrentfile of the result                                                                                                        |
273
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
274
+
275
+
276
+map
277
+~~~
278
+
279
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
280
+| result-parameter        | information                                                                                                                        |
281
++=========================+====================================================================================================================================+
282
+| url                     | string, which is representing the url of the result                                                                                |
283
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
284
+| title                   | string, which is representing the title of the result                                                                              |
285
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
286
+| content                 | string, which is giving a general result-text                                                                                      |
287
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
288
+| publishedDate           | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
289
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
290
+| latitude                | latitude of result (in decimal format)                                                                                             |
291
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
292
+| longitude               | longitude of result (in decimal format)                                                                                            |
293
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
294
+| boundingbox             | boundingbox of result (array of 4. values ``[lat-min, lat-max, lon-min, lon-max]``)                                                |
295
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
296
+| geojson                 | geojson of result (http://geojson.org)                                                                                             |
297
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
298
+| osm.type                | type of osm-object (if OSM-Result)                                                                                                 |
299
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
300
+| osm.id                  | id of osm-object (if OSM-Result)                                                                                                   |
301
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
302
+| address.name            | name of object                                                                                                                     |
303
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
304
+| address.road            | street adress of object                                                                                                            |
305
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
306
+| address.house\_number   | house number of object                                                                                                             |
307
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
308
+| address.locality        | city, place of object                                                                                                              |
309
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
310
+| address.postcode        | postcode of object                                                                                                                 |
311
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
312
+| address.country         | country of object                                                                                                                  |
313
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
314
+

+ 1
- 0
_sources/index.txt Zobrazit soubor

@@ -34,6 +34,7 @@ Developer documentation
34 34
 
35 35
    dev/contribution_guide
36 36
    dev/install/installation
37
+   dev/engine_overview
37 38
    dev/search_api
38 39
    dev/plugins
39 40
    dev/translation

+ 592
- 0
dev/engine_overview.html Zobrazit soubor

@@ -0,0 +1,592 @@
1
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+
5
+<html xmlns="http://www.w3.org/1999/xhtml">
6
+  <head>
7
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+    
9
+    <title>Engine overview &mdash; searx 0.8.0 documentation</title>
10
+    
11
+    <link rel="stylesheet" href="../_static/style.css" type="text/css" />
12
+    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
13
+    
14
+    <script type="text/javascript">
15
+      var DOCUMENTATION_OPTIONS = {
16
+        URL_ROOT:    '../',
17
+        VERSION:     '0.8.0',
18
+        COLLAPSE_INDEX: false,
19
+        FILE_SUFFIX: '.html',
20
+        HAS_SOURCE:  true
21
+      };
22
+    </script>
23
+    <script type="text/javascript" src="../_static/jquery.js"></script>
24
+    <script type="text/javascript" src="../_static/underscore.js"></script>
25
+    <script type="text/javascript" src="../_static/doctools.js"></script>
26
+    <link rel="top" title="searx 0.8.0 documentation" href="../index.html" />
27
+    <link rel="next" title="Search API" href="search_api.html" />
28
+    <link rel="prev" title="Installation" href="install/installation.html" />
29
+   
30
+  
31
+  <link media="only screen and (max-device-width: 480px)" href="../_static/small_flask.css" type= "text/css" rel="stylesheet" />
32
+  <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9">
33
+
34
+  </head>
35
+  <body role="document">  
36
+
37
+    <div class="document">
38
+      <div class="documentwrapper">
39
+        <div class="bodywrapper">
40
+          <div class="body" role="main">
41
+            
42
+  <div class="section" id="engine-overview">
43
+<h1><a class="toc-backref" href="#id2">Engine overview</a><a class="headerlink" href="#engine-overview" title="Permalink to this headline">¶</a></h1>
44
+<p>searx is a <a class="reference external" href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch-engine</a>,
45
+so it is using different search engines to provide better results.</p>
46
+<p>Because there is no general search-api which can be used for every
47
+search-engine, there must be build an adapter between searx and the
48
+external search-engine. This adapters are stored in the folder
49
+<a class="reference external" href="https://github.com/asciimoo/searx/tree/master/searx/engines">*searx/engines*</a>,
50
+and this site is build to make an general documentation about this
51
+engines</p>
52
+<div class="contents topic" id="contents">
53
+<p class="topic-title first">Contents</p>
54
+<ul class="simple">
55
+<li><a class="reference internal" href="#engine-overview" id="id2">Engine overview</a><ul>
56
+<li><a class="reference internal" href="#general-engine-configuration" id="id3">general engine configuration</a><ul>
57
+<li><a class="reference internal" href="#engine-file" id="id4">engine-file</a></li>
58
+<li><a class="reference internal" href="#settings-yml" id="id5">settings.yml</a></li>
59
+<li><a class="reference internal" href="#overrides" id="id6">overrides</a></li>
60
+<li><a class="reference internal" href="#example-code" id="id7">example-code</a></li>
61
+</ul>
62
+</li>
63
+<li><a class="reference internal" href="#doing-request" id="id8">doing request</a><ul>
64
+<li><a class="reference internal" href="#passed-arguments" id="id9">passed arguments</a></li>
65
+<li><a class="reference internal" href="#parsed-arguments" id="id10">parsed arguments</a></li>
66
+<li><a class="reference internal" href="#id1" id="id11">example-code</a></li>
67
+</ul>
68
+</li>
69
+<li><a class="reference internal" href="#returning-results" id="id12">returning results</a><ul>
70
+<li><a class="reference internal" href="#default" id="id13">default</a></li>
71
+<li><a class="reference internal" href="#images" id="id14">images</a></li>
72
+<li><a class="reference internal" href="#videos" id="id15">videos</a></li>
73
+<li><a class="reference internal" href="#torrent" id="id16">torrent</a></li>
74
+<li><a class="reference internal" href="#map" id="id17">map</a></li>
75
+</ul>
76
+</li>
77
+</ul>
78
+</li>
79
+</ul>
80
+</div>
81
+<div class="section" id="general-engine-configuration">
82
+<h2><a class="toc-backref" href="#id3">general engine configuration</a><a class="headerlink" href="#general-engine-configuration" title="Permalink to this headline">¶</a></h2>
83
+<p>It is required to tell searx what results can the engine provide. The
84
+arguments can be inserted in the engine file, or in the settings file
85
+(normally <code class="docutils literal"><span class="pre">settings.yml</span></code>). The arguments in the settings file override
86
+the one in the engine file.</p>
87
+<p>Really, it is for most options no difference if there are contained in
88
+the engine-file or in the settings. But there is a standard where to
89
+place specific arguments by default.</p>
90
+<div class="section" id="engine-file">
91
+<h3><a class="toc-backref" href="#id4">engine-file</a><a class="headerlink" href="#engine-file" title="Permalink to this headline">¶</a></h3>
92
+<table border="1" class="docutils">
93
+<colgroup>
94
+<col width="29%" />
95
+<col width="15%" />
96
+<col width="56%" />
97
+</colgroup>
98
+<thead valign="bottom">
99
+<tr class="row-odd"><th class="head">argument</th>
100
+<th class="head">type</th>
101
+<th class="head">information</th>
102
+</tr>
103
+</thead>
104
+<tbody valign="top">
105
+<tr class="row-even"><td>categories</td>
106
+<td>list</td>
107
+<td>pages, in which the engine is working</td>
108
+</tr>
109
+<tr class="row-odd"><td>paging</td>
110
+<td>boolean</td>
111
+<td>support multible pages</td>
112
+</tr>
113
+<tr class="row-even"><td>language_support</td>
114
+<td>boolean</td>
115
+<td>support language choosing</td>
116
+</tr>
117
+</tbody>
118
+</table>
119
+</div>
120
+<div class="section" id="settings-yml">
121
+<h3><a class="toc-backref" href="#id5">settings.yml</a><a class="headerlink" href="#settings-yml" title="Permalink to this headline">¶</a></h3>
122
+<table border="1" class="docutils">
123
+<colgroup>
124
+<col width="17%" />
125
+<col width="14%" />
126
+<col width="68%" />
127
+</colgroup>
128
+<thead valign="bottom">
129
+<tr class="row-odd"><th class="head">argument</th>
130
+<th class="head">type</th>
131
+<th class="head">information</th>
132
+</tr>
133
+</thead>
134
+<tbody valign="top">
135
+<tr class="row-even"><td>name</td>
136
+<td>string</td>
137
+<td>name of search-engine</td>
138
+</tr>
139
+<tr class="row-odd"><td>engine</td>
140
+<td>string</td>
141
+<td>name of searx-engine (filename without .py)</td>
142
+</tr>
143
+<tr class="row-even"><td>shortcut</td>
144
+<td>string</td>
145
+<td>shortcut of search-engine</td>
146
+</tr>
147
+<tr class="row-odd"><td>timeout</td>
148
+<td>string</td>
149
+<td>specific timeout for search-engine</td>
150
+</tr>
151
+</tbody>
152
+</table>
153
+</div>
154
+<div class="section" id="overrides">
155
+<h3><a class="toc-backref" href="#id6">overrides</a><a class="headerlink" href="#overrides" title="Permalink to this headline">¶</a></h3>
156
+<p>There are some options, with have default values in the engine, but are
157
+often overwritten by the settings. If the option is assigned in the
158
+engine-file with <code class="docutils literal"><span class="pre">None</span></code> it has to be redefined in the settings,
159
+otherwise searx is not starting with that engine.</p>
160
+<p>The naming of that overrides can be wathever you want. But we recommend
161
+the using of already used overrides if possible:</p>
162
+<table border="1" class="docutils">
163
+<colgroup>
164
+<col width="24%" />
165
+<col width="11%" />
166
+<col width="65%" />
167
+</colgroup>
168
+<thead valign="bottom">
169
+<tr class="row-odd"><th class="head">argument</th>
170
+<th class="head">type</th>
171
+<th class="head">information</th>
172
+</tr>
173
+</thead>
174
+<tbody valign="top">
175
+<tr class="row-even"><td>base_url</td>
176
+<td>string</td>
177
+<td>base-url, can be overwrite to use same engine on other url</td>
178
+</tr>
179
+<tr class="row-odd"><td>number_of_results</td>
180
+<td>int</td>
181
+<td>maximum number of results per request</td>
182
+</tr>
183
+<tr class="row-even"><td>language</td>
184
+<td>string</td>
185
+<td>ISO code of language and country like en_US</td>
186
+</tr>
187
+<tr class="row-odd"><td>api_key</td>
188
+<td>string</td>
189
+<td>api-key if required by engine</td>
190
+</tr>
191
+</tbody>
192
+</table>
193
+</div>
194
+<div class="section" id="example-code">
195
+<h3><a class="toc-backref" href="#id7">example-code</a><a class="headerlink" href="#example-code" title="Permalink to this headline">¶</a></h3>
196
+<div class="code python highlight-python"><div class="highlight"><pre><span class="c"># engine dependent config</span>
197
+<span class="n">categories</span> <span class="o">=</span> <span class="p">[</span><span class="s">&#39;general&#39;</span><span class="p">]</span>
198
+<span class="n">paging</span> <span class="o">=</span> <span class="bp">True</span>
199
+<span class="n">language_support</span> <span class="o">=</span> <span class="bp">True</span>
200
+</pre></div>
201
+</div>
202
+</div>
203
+</div>
204
+<div class="section" id="doing-request">
205
+<h2><a class="toc-backref" href="#id8">doing request</a><a class="headerlink" href="#doing-request" title="Permalink to this headline">¶</a></h2>
206
+<p>To perform a search you have to specific at least a url on which the
207
+request is performing</p>
208
+<div class="section" id="passed-arguments">
209
+<h3><a class="toc-backref" href="#id9">passed arguments</a><a class="headerlink" href="#passed-arguments" title="Permalink to this headline">¶</a></h3>
210
+<p>This arguments can be used to calculate the search-query. Furthermore,
211
+some of that parameters are filled with default values which can be
212
+changed for special purpose.</p>
213
+<table border="1" class="docutils">
214
+<colgroup>
215
+<col width="21%" />
216
+<col width="11%" />
217
+<col width="68%" />
218
+</colgroup>
219
+<thead valign="bottom">
220
+<tr class="row-odd"><th class="head">argument</th>
221
+<th class="head">type</th>
222
+<th class="head">default-value, informations</th>
223
+</tr>
224
+</thead>
225
+<tbody valign="top">
226
+<tr class="row-even"><td>url</td>
227
+<td>string</td>
228
+<td><code class="docutils literal"><span class="pre">''</span></code></td>
229
+</tr>
230
+<tr class="row-odd"><td>method</td>
231
+<td>string</td>
232
+<td><code class="docutils literal"><span class="pre">'GET'</span></code></td>
233
+</tr>
234
+<tr class="row-even"><td>headers</td>
235
+<td>set</td>
236
+<td><code class="docutils literal"><span class="pre">{}</span></code></td>
237
+</tr>
238
+<tr class="row-odd"><td>data</td>
239
+<td>set</td>
240
+<td><code class="docutils literal"><span class="pre">{}</span></code></td>
241
+</tr>
242
+<tr class="row-even"><td>cookies</td>
243
+<td>set</td>
244
+<td><code class="docutils literal"><span class="pre">{}</span></code></td>
245
+</tr>
246
+<tr class="row-odd"><td>verify</td>
247
+<td>boolean</td>
248
+<td><code class="docutils literal"><span class="pre">True</span></code></td>
249
+</tr>
250
+<tr class="row-even"><td>headers.User-Agent</td>
251
+<td>string</td>
252
+<td>a random User-Agent</td>
253
+</tr>
254
+<tr class="row-odd"><td>category</td>
255
+<td>string</td>
256
+<td>current category, like <code class="docutils literal"><span class="pre">'general'</span></code></td>
257
+</tr>
258
+<tr class="row-even"><td>started</td>
259
+<td>datetime</td>
260
+<td>current date-time</td>
261
+</tr>
262
+<tr class="row-odd"><td>pageno</td>
263
+<td>int</td>
264
+<td>current pagenumber</td>
265
+</tr>
266
+<tr class="row-even"><td>language</td>
267
+<td>string</td>
268
+<td>specific language code like <code class="docutils literal"><span class="pre">'en_US'</span></code>, or <code class="docutils literal"><span class="pre">'all'</span></code> if unspecified</td>
269
+</tr>
270
+</tbody>
271
+</table>
272
+</div>
273
+<div class="section" id="parsed-arguments">
274
+<h3><a class="toc-backref" href="#id10">parsed arguments</a><a class="headerlink" href="#parsed-arguments" title="Permalink to this headline">¶</a></h3>
275
+<p>The function <code class="docutils literal"><span class="pre">def</span> <span class="pre">request(query,</span> <span class="pre">params):</span></code> is always returning the
276
+<code class="docutils literal"><span class="pre">params</span></code> variable back. Inside searx, the following paramters can be
277
+used to specific a search-request:</p>
278
+<table border="1" class="docutils">
279
+<colgroup>
280
+<col width="15%" />
281
+<col width="14%" />
282
+<col width="72%" />
283
+</colgroup>
284
+<thead valign="bottom">
285
+<tr class="row-odd"><th class="head">argument</th>
286
+<th class="head">type</th>
287
+<th class="head">information</th>
288
+</tr>
289
+</thead>
290
+<tbody valign="top">
291
+<tr class="row-even"><td>url</td>
292
+<td>string</td>
293
+<td>requested url</td>
294
+</tr>
295
+<tr class="row-odd"><td>method</td>
296
+<td>string</td>
297
+<td>HTTP request methode</td>
298
+</tr>
299
+<tr class="row-even"><td>headers</td>
300
+<td>set</td>
301
+<td>HTTP header informations</td>
302
+</tr>
303
+<tr class="row-odd"><td>data</td>
304
+<td>set</td>
305
+<td>HTTP data informations (parsed if <code class="docutils literal"><span class="pre">method</span> <span class="pre">!=</span> <span class="pre">'GET'</span></code>)</td>
306
+</tr>
307
+<tr class="row-even"><td>cookies</td>
308
+<td>set</td>
309
+<td>HTTP cookies</td>
310
+</tr>
311
+<tr class="row-odd"><td>verify</td>
312
+<td>boolean</td>
313
+<td>Performing SSL-Validity check</td>
314
+</tr>
315
+</tbody>
316
+</table>
317
+</div>
318
+<div class="section" id="id1">
319
+<h3><a class="toc-backref" href="#id11">example-code</a><a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h3>
320
+<div class="code python highlight-python"><div class="highlight"><pre><span class="c"># search-url</span>
321
+<span class="n">base_url</span> <span class="o">=</span> <span class="s">&#39;https://example.com/&#39;</span>
322
+<span class="n">search_string</span> <span class="o">=</span> <span class="s">&#39;search?{query}&amp;page={page}&#39;</span>
323
+
324
+<span class="c"># do search-request</span>
325
+<span class="k">def</span> <span class="nf">request</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="n">params</span><span class="p">):</span>
326
+    <span class="n">search_path</span> <span class="o">=</span> <span class="n">search_string</span><span class="o">.</span><span class="n">format</span><span class="p">(</span>
327
+        <span class="n">query</span><span class="o">=</span><span class="n">urlencode</span><span class="p">({</span><span class="s">&#39;q&#39;</span><span class="p">:</span> <span class="n">query</span><span class="p">}),</span>
328
+        <span class="n">page</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s">&#39;pageno&#39;</span><span class="p">])</span>
329
+
330
+    <span class="n">params</span><span class="p">[</span><span class="s">&#39;url&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">base_url</span> <span class="o">+</span> <span class="n">search_path</span>
331
+
332
+    <span class="k">return</span> <span class="n">params</span>
333
+</pre></div>
334
+</div>
335
+</div>
336
+</div>
337
+<div class="section" id="returning-results">
338
+<h2><a class="toc-backref" href="#id12">returning results</a><a class="headerlink" href="#returning-results" title="Permalink to this headline">¶</a></h2>
339
+<p>Searx has the possiblity to return results in different media-types.
340
+Currently the following media-types are supported:</p>
341
+<ul class="simple">
342
+<li>default</li>
343
+<li>images</li>
344
+<li>videos</li>
345
+<li>torrent</li>
346
+<li>map</li>
347
+</ul>
348
+<p>to set another media-type as default, you must set the parameter
349
+<code class="docutils literal"><span class="pre">template</span></code> to the required type.</p>
350
+<div class="section" id="default">
351
+<h3><a class="toc-backref" href="#id13">default</a><a class="headerlink" href="#default" title="Permalink to this headline">¶</a></h3>
352
+<table border="1" class="docutils">
353
+<colgroup>
354
+<col width="13%" />
355
+<col width="87%" />
356
+</colgroup>
357
+<thead valign="bottom">
358
+<tr class="row-odd"><th class="head">result-parameter</th>
359
+<th class="head">information</th>
360
+</tr>
361
+</thead>
362
+<tbody valign="top">
363
+<tr class="row-even"><td>url</td>
364
+<td>string, which is representing the url of the result</td>
365
+</tr>
366
+<tr class="row-odd"><td>title</td>
367
+<td>string, which is representing the title of the result</td>
368
+</tr>
369
+<tr class="row-even"><td>content</td>
370
+<td>string, which is giving a general result-text</td>
371
+</tr>
372
+<tr class="row-odd"><td>publishedDate</td>
373
+<td><a class="reference external" href="https://docs.python.org/2/library/datetime.html#datetime-objects">datetime.datetime</a>, represent when the result is published</td>
374
+</tr>
375
+</tbody>
376
+</table>
377
+</div>
378
+<div class="section" id="images">
379
+<h3><a class="toc-backref" href="#id14">images</a><a class="headerlink" href="#images" title="Permalink to this headline">¶</a></h3>
380
+<p>to use this template, the parameter</p>
381
+<table border="1" class="docutils">
382
+<colgroup>
383
+<col width="11%" />
384
+<col width="89%" />
385
+</colgroup>
386
+<thead valign="bottom">
387
+<tr class="row-odd"><th class="head">result-parameter</th>
388
+<th class="head">information</th>
389
+</tr>
390
+</thead>
391
+<tbody valign="top">
392
+<tr class="row-even"><td>template</td>
393
+<td>is set to <code class="docutils literal"><span class="pre">images.html</span></code></td>
394
+</tr>
395
+<tr class="row-odd"><td>url</td>
396
+<td>string, which is representing the url to the result site</td>
397
+</tr>
398
+<tr class="row-even"><td>title</td>
399
+<td>string, which is representing the title of the result <em>(partly implemented)</em></td>
400
+</tr>
401
+<tr class="row-odd"><td>content</td>
402
+<td><em>(partly implemented)</em></td>
403
+</tr>
404
+<tr class="row-even"><td>publishedDate</td>
405
+<td><a class="reference external" href="https://docs.python.org/2/library/datetime.html#datetime-objects">datetime.datetime</a>, represent when the result is published <em>(partly implemented)</em></td>
406
+</tr>
407
+<tr class="row-odd"><td>img_src</td>
408
+<td>string, which is representing the url to the result image</td>
409
+</tr>
410
+<tr class="row-even"><td>thumbnail_src</td>
411
+<td>string, which is representing the url to a small-preview image</td>
412
+</tr>
413
+</tbody>
414
+</table>
415
+</div>
416
+<div class="section" id="videos">
417
+<h3><a class="toc-backref" href="#id15">videos</a><a class="headerlink" href="#videos" title="Permalink to this headline">¶</a></h3>
418
+<table border="1" class="docutils">
419
+<colgroup>
420
+<col width="13%" />
421
+<col width="87%" />
422
+</colgroup>
423
+<thead valign="bottom">
424
+<tr class="row-odd"><th class="head">result-parameter</th>
425
+<th class="head">information</th>
426
+</tr>
427
+</thead>
428
+<tbody valign="top">
429
+<tr class="row-even"><td>template</td>
430
+<td>is set to <code class="docutils literal"><span class="pre">videos.html</span></code></td>
431
+</tr>
432
+<tr class="row-odd"><td>url</td>
433
+<td>string, which is representing the url of the result</td>
434
+</tr>
435
+<tr class="row-even"><td>title</td>
436
+<td>string, which is representing the title of the result</td>
437
+</tr>
438
+<tr class="row-odd"><td>content</td>
439
+<td><em>(not implemented yet)</em></td>
440
+</tr>
441
+<tr class="row-even"><td>publishedDate</td>
442
+<td><a class="reference external" href="https://docs.python.org/2/library/datetime.html#datetime-objects">datetime.datetime</a>, represent when the result is published</td>
443
+</tr>
444
+<tr class="row-odd"><td>thumbnail</td>
445
+<td>string, which is representing the url to a small-preview image</td>
446
+</tr>
447
+</tbody>
448
+</table>
449
+</div>
450
+<div class="section" id="torrent">
451
+<h3><a class="toc-backref" href="#id16">torrent</a><a class="headerlink" href="#torrent" title="Permalink to this headline">¶</a></h3>
452
+<table border="1" class="docutils">
453
+<colgroup>
454
+<col width="11%" />
455
+<col width="89%" />
456
+</colgroup>
457
+<tbody valign="top">
458
+<tr class="row-odd"><td>result-parameter</td>
459
+<td>information</td>
460
+</tr>
461
+<tr class="row-even"><td>template</td>
462
+<td>is set to <code class="docutils literal"><span class="pre">`torrent.html`</span></code></td>
463
+</tr>
464
+<tr class="row-odd"><td>url</td>
465
+<td>string, which is representing the url of the result</td>
466
+</tr>
467
+<tr class="row-even"><td>title</td>
468
+<td>string, which is representing the title of the result</td>
469
+</tr>
470
+<tr class="row-odd"><td>content</td>
471
+<td>string, which is giving a general result-text</td>
472
+</tr>
473
+<tr class="row-even"><td>publishedDate</td>
474
+<td>[datetime.datetime](<a class="reference external" href="https://docs.python.org/2/library/datetime.html#datetime-objects">https://docs.python.org/2/library/datetime.html#datetime-objects</a>), represent when the result is published _(not implemented yet)_</td>
475
+</tr>
476
+<tr class="row-odd"><td>seed</td>
477
+<td>int, number of seeder</td>
478
+</tr>
479
+<tr class="row-even"><td>leech</td>
480
+<td>int, number of leecher</td>
481
+</tr>
482
+<tr class="row-odd"><td>filesize</td>
483
+<td>int, size of file in bytes</td>
484
+</tr>
485
+<tr class="row-even"><td>files</td>
486
+<td>int, number of files</td>
487
+</tr>
488
+<tr class="row-odd"><td>magnetlink</td>
489
+<td>string, which is the [magnetlink](<a class="reference external" href="https://en.wikipedia.org/wiki/Magnet_URI_scheme">https://en.wikipedia.org/wiki/Magnet_URI_scheme</a>) of the result</td>
490
+</tr>
491
+<tr class="row-even"><td>torrentfile</td>
492
+<td>string, which is the torrentfile of the result</td>
493
+</tr>
494
+</tbody>
495
+</table>
496
+</div>
497
+<div class="section" id="map">
498
+<h3><a class="toc-backref" href="#id17">map</a><a class="headerlink" href="#map" title="Permalink to this headline">¶</a></h3>
499
+<table border="1" class="docutils">
500
+<colgroup>
501
+<col width="16%" />
502
+<col width="84%" />
503
+</colgroup>
504
+<thead valign="bottom">
505
+<tr class="row-odd"><th class="head">result-parameter</th>
506
+<th class="head">information</th>
507
+</tr>
508
+</thead>
509
+<tbody valign="top">
510
+<tr class="row-even"><td>url</td>
511
+<td>string, which is representing the url of the result</td>
512
+</tr>
513
+<tr class="row-odd"><td>title</td>
514
+<td>string, which is representing the title of the result</td>
515
+</tr>
516
+<tr class="row-even"><td>content</td>
517
+<td>string, which is giving a general result-text</td>
518
+</tr>
519
+<tr class="row-odd"><td>publishedDate</td>
520
+<td><a class="reference external" href="https://docs.python.org/2/library/datetime.html#datetime-objects">datetime.datetime</a>, represent when the result is published</td>
521
+</tr>
522
+<tr class="row-even"><td>latitude</td>
523
+<td>latitude of result (in decimal format)</td>
524
+</tr>
525
+<tr class="row-odd"><td>longitude</td>
526
+<td>longitude of result (in decimal format)</td>
527
+</tr>
528
+<tr class="row-even"><td>boundingbox</td>
529
+<td>boundingbox of result (array of 4. values <code class="docutils literal"><span class="pre">[lat-min,</span> <span class="pre">lat-max,</span> <span class="pre">lon-min,</span> <span class="pre">lon-max]</span></code>)</td>
530
+</tr>
531
+<tr class="row-odd"><td>geojson</td>
532
+<td>geojson of result (<a class="reference external" href="http://geojson.org">http://geojson.org</a>)</td>
533
+</tr>
534
+<tr class="row-even"><td>osm.type</td>
535
+<td>type of osm-object (if OSM-Result)</td>
536
+</tr>
537
+<tr class="row-odd"><td>osm.id</td>
538
+<td>id of osm-object (if OSM-Result)</td>
539
+</tr>
540
+<tr class="row-even"><td>address.name</td>
541
+<td>name of object</td>
542
+</tr>
543
+<tr class="row-odd"><td>address.road</td>
544
+<td>street adress of object</td>
545
+</tr>
546
+<tr class="row-even"><td>address.house_number</td>
547
+<td>house number of object</td>
548
+</tr>
549
+<tr class="row-odd"><td>address.locality</td>
550
+<td>city, place of object</td>
551
+</tr>
552
+<tr class="row-even"><td>address.postcode</td>
553
+<td>postcode of object</td>
554
+</tr>
555
+<tr class="row-odd"><td>address.country</td>
556
+<td>country of object</td>
557
+</tr>
558
+</tbody>
559
+</table>
560
+</div>
561
+</div>
562
+</div>
563
+
564
+
565
+          </div>
566
+        </div>
567
+      </div>
568
+      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
569
+        <div class="sphinxsidebarwrapper"><div class="sidebar_container body">
570
+<h1>Searx</h1>
571
+<ul>
572
+    <li><a href="../index.html">Home</a></li>
573
+    <li><a href="https://github.com/asciimoo/searx">Source</a></li>
574
+    <li><a href="https://github.com/asciimoo/searx/wiki">Wiki</a></li>
575
+    <li><a href="https://github.com/asciimoo/searx/wiki/Searx-instances">Public instances</a></li>
576
+</ul>
577
+<hr />
578
+<ul>
579
+    <li><a href="https://twitter.com/Searx_engine">Twitter</a></li>
580
+    <li><a href="https://flattr.com/submit/auto?user_id=asciimoo&url=https://github.com/asciimoo/searx&title=searx&language=&tags=github&category=software">Flattr</a></li>
581
+    <li><a href="https://gratipay.com/searx">Gratipay</a></li>
582
+</ul>
583
+</div>
584
+        </div>
585
+      </div>
586
+      <div class="clearer"></div>
587
+    </div>
588
+    <div class="footer">
589
+      &copy; Copyright 2015, Adam Tauber.
590
+    </div>
591
+  </body>
592
+</html>

+ 314
- 0
docs/dev/engine_overview.rst Zobrazit soubor

@@ -0,0 +1,314 @@
1
+Engine overview
2
+===============
3
+
4
+
5
+searx is a `metasearch-engine <https://en.wikipedia.org/wiki/Metasearch_engine>`__,
6
+so it is using different search engines to provide better results.
7
+
8
+Because there is no general search-api which can be used for every
9
+search-engine, there must be build an adapter between searx and the
10
+external search-engine. This adapters are stored in the folder
11
+`*searx/engines* <https://github.com/asciimoo/searx/tree/master/searx/engines>`__,
12
+and this site is build to make an general documentation about this
13
+engines
14
+
15
+
16
+.. contents::
17
+   :depth: 3
18
+
19
+general engine configuration
20
+----------------------------
21
+
22
+It is required to tell searx what results can the engine provide. The
23
+arguments can be inserted in the engine file, or in the settings file
24
+(normally ``settings.yml``). The arguments in the settings file override
25
+the one in the engine file.
26
+
27
+Really, it is for most options no difference if there are contained in
28
+the engine-file or in the settings. But there is a standard where to
29
+place specific arguments by default.
30
+
31
+
32
+engine-file
33
+~~~~~~~~~~~
34
+
35
++---------------------+-----------+-----------------------------------------+
36
+| argument            | type      | information                             |
37
++=====================+===========+=========================================+
38
+| categories          | list      | pages, in which the engine is working   |
39
++---------------------+-----------+-----------------------------------------+
40
+| paging              | boolean   | support multible pages                  |
41
++---------------------+-----------+-----------------------------------------+
42
+| language\_support   | boolean   | support language choosing               |
43
++---------------------+-----------+-----------------------------------------+
44
+
45
+settings.yml
46
+~~~~~~~~~~~~
47
+
48
++------------+----------+-----------------------------------------------+
49
+| argument   | type     | information                                   |
50
++============+==========+===============================================+
51
+| name       | string   | name of search-engine                         |
52
++------------+----------+-----------------------------------------------+
53
+| engine     | string   | name of searx-engine (filename without .py)   |
54
++------------+----------+-----------------------------------------------+
55
+| shortcut   | string   | shortcut of search-engine                     |
56
++------------+----------+-----------------------------------------------+
57
+| timeout    | string   | specific timeout for search-engine            |
58
++------------+----------+-----------------------------------------------+
59
+
60
+overrides
61
+~~~~~~~~~
62
+
63
+There are some options, with have default values in the engine, but are
64
+often overwritten by the settings. If the option is assigned in the
65
+engine-file with ``None`` it has to be redefined in the settings,
66
+otherwise searx is not starting with that engine.
67
+
68
+The naming of that overrides can be wathever you want. But we recommend
69
+the using of already used overrides if possible:
70
+
71
++-----------------------+----------+--------------------------------------------------------------+
72
+| argument              | type     | information                                                  |
73
++=======================+==========+==============================================================+
74
+| base\_url             | string   | base-url, can be overwrite to use same engine on other url   |
75
++-----------------------+----------+--------------------------------------------------------------+
76
+| number\_of\_results   | int      | maximum number of results per request                        |
77
++-----------------------+----------+--------------------------------------------------------------+
78
+| language              | string   | ISO code of language and country like en\_US                 |
79
++-----------------------+----------+--------------------------------------------------------------+
80
+| api\_key              | string   | api-key if required by engine                                |
81
++-----------------------+----------+--------------------------------------------------------------+
82
+
83
+example-code
84
+~~~~~~~~~~~~
85
+
86
+.. code:: python
87
+
88
+    # engine dependent config
89
+    categories = ['general']
90
+    paging = True
91
+    language_support = True
92
+
93
+doing request
94
+-------------
95
+
96
+To perform a search you have to specific at least a url on which the
97
+request is performing
98
+
99
+passed arguments
100
+~~~~~~~~~~~~~~~~
101
+
102
+This arguments can be used to calculate the search-query. Furthermore,
103
+some of that parameters are filled with default values which can be
104
+changed for special purpose.
105
+
106
++----------------------+------------+------------------------------------------------------------------------+
107
+| argument             | type       | default-value, informations                                            |
108
++======================+============+========================================================================+
109
+| url                  | string     | ``''``                                                                 |
110
++----------------------+------------+------------------------------------------------------------------------+
111
+| method               | string     | ``'GET'``                                                              |
112
++----------------------+------------+------------------------------------------------------------------------+
113
+| headers              | set        | ``{}``                                                                 |
114
++----------------------+------------+------------------------------------------------------------------------+
115
+| data                 | set        | ``{}``                                                                 |
116
++----------------------+------------+------------------------------------------------------------------------+
117
+| cookies              | set        | ``{}``                                                                 |
118
++----------------------+------------+------------------------------------------------------------------------+
119
+| verify               | boolean    | ``True``                                                               |
120
++----------------------+------------+------------------------------------------------------------------------+
121
+| headers.User-Agent   | string     | a random User-Agent                                                    |
122
++----------------------+------------+------------------------------------------------------------------------+
123
+| category             | string     | current category, like ``'general'``                                   |
124
++----------------------+------------+------------------------------------------------------------------------+
125
+| started              | datetime   | current date-time                                                      |
126
++----------------------+------------+------------------------------------------------------------------------+
127
+| pageno               | int        | current pagenumber                                                     |
128
++----------------------+------------+------------------------------------------------------------------------+
129
+| language             | string     | specific language code like ``'en_US'``, or ``'all'`` if unspecified   |
130
++----------------------+------------+------------------------------------------------------------------------+
131
+
132
+parsed arguments
133
+~~~~~~~~~~~~~~~~
134
+
135
+The function ``def request(query, params):`` is always returning the
136
+``params`` variable back. Inside searx, the following paramters can be
137
+used to specific a search-request:
138
+
139
++------------+-----------+----------------------------------------------------------+
140
+| argument   | type      | information                                              |
141
++============+===========+==========================================================+
142
+| url        | string    | requested url                                            |
143
++------------+-----------+----------------------------------------------------------+
144
+| method     | string    | HTTP request methode                                     |
145
++------------+-----------+----------------------------------------------------------+
146
+| headers    | set       | HTTP header informations                                 |
147
++------------+-----------+----------------------------------------------------------+
148
+| data       | set       | HTTP data informations (parsed if ``method != 'GET'``)   |
149
++------------+-----------+----------------------------------------------------------+
150
+| cookies    | set       | HTTP cookies                                             |
151
++------------+-----------+----------------------------------------------------------+
152
+| verify     | boolean   | Performing SSL-Validity check                            |
153
++------------+-----------+----------------------------------------------------------+
154
+
155
+example-code
156
+~~~~~~~~~~~~
157
+
158
+.. code:: python
159
+
160
+    # search-url
161
+    base_url = 'https://example.com/'
162
+    search_string = 'search?{query}&page={page}'
163
+
164
+    # do search-request
165
+    def request(query, params):
166
+        search_path = search_string.format(
167
+            query=urlencode({'q': query}),
168
+            page=params['pageno'])
169
+
170
+        params['url'] = base_url + search_path
171
+
172
+        return params
173
+
174
+returning results
175
+-----------------
176
+
177
+Searx has the possiblity to return results in different media-types.
178
+Currently the following media-types are supported:
179
+
180
+-  default
181
+-  images
182
+-  videos
183
+-  torrent
184
+-  map
185
+
186
+to set another media-type as default, you must set the parameter
187
+``template`` to the required type.
188
+
189
+default
190
+~~~~~~~
191
+
192
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
193
+| result-parameter   | information                                                                                                                        |
194
++====================+====================================================================================================================================+
195
+| url                | string, which is representing the url of the result                                                                                |
196
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
197
+| title              | string, which is representing the title of the result                                                                              |
198
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
199
+| content            | string, which is giving a general result-text                                                                                      |
200
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
201
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
202
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
203
+
204
+images
205
+~~~~~~
206
+
207
+to use this template, the parameter
208
+
209
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
210
+| result-parameter   | information                                                                                                                                               |
211
++====================+===========================================================================================================================================================+
212
+| template           | is set to ``images.html``                                                                                                                                 |
213
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
214
+| url                | string, which is representing the url to the result site                                                                                                  |
215
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
216
+| title              | string, which is representing the title of the result *(partly implemented)*                                                                              |
217
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
218
+| content            | *(partly implemented)*                                                                                                                                    |
219
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
220
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published *(partly implemented)*   |
221
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
222
+| img\_src           | string, which is representing the url to the result image                                                                                                 |
223
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
224
+| thumbnail\_src     | string, which is representing the url to a small-preview image                                                                                            |
225
++--------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------+
226
+
227
+videos
228
+~~~~~~
229
+
230
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
231
+| result-parameter   | information                                                                                                                        |
232
++====================+====================================================================================================================================+
233
+| template           | is set to ``videos.html``                                                                                                          |
234
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
235
+| url                | string, which is representing the url of the result                                                                                |
236
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
237
+| title              | string, which is representing the title of the result                                                                              |
238
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
239
+| content            | *(not implemented yet)*                                                                                                            |
240
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
241
+| publishedDate      | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
242
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
243
+| thumbnail          | string, which is representing the url to a small-preview image                                                                     |
244
++--------------------+------------------------------------------------------------------------------------------------------------------------------------+
245
+
246
+torrent
247
+~~~~~~~
248
+
249
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
250
+| result-parameter | information                                                                                                                                           |
251
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
252
+| template         | is set to ```torrent.html```                                                                                                                          |
253
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
254
+| url              | string, which is representing the url of the result                                                                                                   |
255
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
256
+| title            | string, which is representing the title of the result                                                                                                 |
257
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
258
+| content          | string, which is giving a general result-text                                                                                                         |
259
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
260
+| publishedDate    | [datetime.datetime](https://docs.python.org/2/library/datetime.html#datetime-objects), represent when the result is published _(not implemented yet)_ |
261
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
262
+| seed             | int, number of seeder                                                                                                                                 |
263
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
264
+| leech            | int, number of leecher                                                                                                                                |
265
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
266
+| filesize         | int, size of file in bytes                                                                                                                            |
267
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
268
+| files            | int, number of files                                                                                                                                  |
269
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
270
+| magnetlink       | string, which is the [magnetlink](https://en.wikipedia.org/wiki/Magnet_URI_scheme) of the result                                                      |
271
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
272
+| torrentfile      | string, which is the torrentfile of the result                                                                                                        |
273
++------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------+
274
+
275
+
276
+map
277
+~~~
278
+
279
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
280
+| result-parameter        | information                                                                                                                        |
281
++=========================+====================================================================================================================================+
282
+| url                     | string, which is representing the url of the result                                                                                |
283
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
284
+| title                   | string, which is representing the title of the result                                                                              |
285
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
286
+| content                 | string, which is giving a general result-text                                                                                      |
287
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
288
+| publishedDate           | `datetime.datetime <https://docs.python.org/2/library/datetime.html#datetime-objects>`__, represent when the result is published   |
289
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
290
+| latitude                | latitude of result (in decimal format)                                                                                             |
291
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
292
+| longitude               | longitude of result (in decimal format)                                                                                            |
293
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
294
+| boundingbox             | boundingbox of result (array of 4. values ``[lat-min, lat-max, lon-min, lon-max]``)                                                |
295
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
296
+| geojson                 | geojson of result (http://geojson.org)                                                                                             |
297
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
298
+| osm.type                | type of osm-object (if OSM-Result)                                                                                                 |
299
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
300
+| osm.id                  | id of osm-object (if OSM-Result)                                                                                                   |
301
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
302
+| address.name            | name of object                                                                                                                     |
303
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
304
+| address.road            | street adress of object                                                                                                            |
305
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
306
+| address.house\_number   | house number of object                                                                                                             |
307
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
308
+| address.locality        | city, place of object                                                                                                              |
309
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
310
+| address.postcode        | postcode of object                                                                                                                 |
311
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
312
+| address.country         | country of object                                                                                                                  |
313
++-------------------------+------------------------------------------------------------------------------------------------------------------------------------+
314
+

+ 1
- 0
docs/index.rst Zobrazit soubor

@@ -34,6 +34,7 @@ Developer documentation
34 34
 
35 35
    dev/contribution_guide
36 36
    dev/install/installation
37
+   dev/engine_overview
37 38
    dev/search_api
38 39
    dev/plugins
39 40
    dev/translation

+ 1
- 0
index.html Zobrazit soubor

@@ -70,6 +70,7 @@
70 70
 <ul>
71 71
 <li class="toctree-l1"><a class="reference internal" href="dev/contribution_guide.html">How to contribute</a></li>
72 72
 <li class="toctree-l1"><a class="reference internal" href="dev/install/installation.html">Installation</a></li>
73
+<li class="toctree-l1"><a class="reference internal" href="dev/engine_overview.html">Engine overview</a></li>
73 74
 <li class="toctree-l1"><a class="reference internal" href="dev/search_api.html">Search API</a></li>
74 75
 <li class="toctree-l1"><a class="reference internal" href="dev/plugins.html">Plugins</a></li>
75 76
 <li class="toctree-l1"><a class="reference internal" href="dev/translation.html">Translation</a></li>

+ 1
- 1
searchindex.js
Diff nebyl zobrazen, protože je příliš veliký
Zobrazit soubor