searx/dev/engine_overview.html

742 lines
31 KiB
HTML
Raw Normal View History

2019-12-30 18:31:17 +01:00
<!DOCTYPE html>
2015-11-28 19:26:45 +01:00
2020-06-19 11:15:15 +02:00
<html>
2015-11-28 19:26:45 +01:00
<head>
2019-12-30 18:31:17 +01:00
<meta charset="utf-8" />
2020-09-30 10:35:05 +02:00
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2019-12-30 18:31:17 +01:00
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Engine overview &#8212; Searx Documentation (Searx-1.0.0.tex)</title>
2015-11-28 19:26:45 +01:00
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/searx.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
2020-02-15 10:08:58 +01:00
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
2016-11-04 21:56:14 +01:00
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
2015-11-28 19:26:45 +01:00
<link rel="next" title="Search API" href="search_api.html" />
2016-07-09 22:32:57 +02:00
<link rel="prev" title="How to contribute" href="contribution_guide.html" />
2019-12-30 18:31:17 +01:00
<script>DOCUMENTATION_OPTIONS.URL_ROOT = '../';</script>
2015-11-28 19:26:45 +01:00
2019-12-30 18:31:17 +01:00
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
2019-12-30 18:31:17 +01:00
<li class="right" >
<a href="search_api.html" title="Search API"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="contribution_guide.html" title="How to contribute"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-1.0.0.tex)</a> &#187;</li>
2020-09-30 10:35:05 +02:00
<li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Developer documentation</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Engine overview</a></li>
2019-12-30 18:31:17 +01:00
</ul>
</div>
2015-11-28 19:26:45 +01:00
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="engine-overview">
<span id="engines-dev"></span><h1><a class="toc-backref" href="#id4">Engine overview</a><a class="headerlink" href="#engine-overview" title="Permalink to this headline"></a></h1>
2019-12-30 18:31:17 +01:00
<p>searx is a <a class="reference external" href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch-engine</a>, so it uses different search engines to provide
better results.</p>
<p>Because there is no general search API which could be used for every search
engine, an adapter has to be built between searx and the external search
2020-09-30 10:35:05 +02:00
engines. Adapters are stored under the folder <a class="reference external" href="https://github.com/searx/searx/blob/master/searx/engines">git://searx/engines</a>.</p>
2015-11-28 19:26:45 +01:00
<div class="contents topic" id="contents">
2020-02-15 10:08:58 +01:00
<p class="topic-title">Contents</p>
2015-11-28 19:26:45 +01:00
<ul class="simple">
<li><p><a class="reference internal" href="#engine-overview" id="id4">Engine overview</a></p>
2019-12-30 18:31:17 +01:00
<ul>
<li><p><a class="reference internal" href="#general-engine-configuration" id="id5">general engine configuration</a></p>
2019-12-30 18:31:17 +01:00
<ul>
<li><p><a class="reference internal" href="#engine-file" id="id6">engine file</a></p></li>
<li><p><a class="reference internal" href="#settings-yml" id="id7">settings.yml</a></p></li>
<li><p><a class="reference internal" href="#overrides" id="id8">overrides</a></p></li>
<li><p><a class="reference internal" href="#example-code" id="id9">example code</a></p></li>
2015-11-28 19:26:45 +01:00
</ul>
</li>
<li><p><a class="reference internal" href="#making-a-request" id="id10">making a request</a></p>
2019-12-30 18:31:17 +01:00
<ul>
<li><p><a class="reference internal" href="#passed-arguments" id="id11">passed arguments</a></p></li>
<li><p><a class="reference internal" href="#parsed-arguments" id="id12">parsed arguments</a></p></li>
<li><p><a class="reference internal" href="#id3" id="id13">example code</a></p></li>
2015-11-28 19:26:45 +01:00
</ul>
</li>
<li><p><a class="reference internal" href="#returned-results" id="id14">returned results</a></p>
2019-12-30 18:31:17 +01:00
<ul>
<li><p><a class="reference internal" href="#default" id="id15">default</a></p></li>
<li><p><a class="reference internal" href="#images" id="id16">images</a></p></li>
<li><p><a class="reference internal" href="#videos" id="id17">videos</a></p></li>
<li><p><a class="reference internal" href="#torrent" id="id18">torrent</a></p></li>
<li><p><a class="reference internal" href="#map" id="id19">map</a></p></li>
2015-11-28 19:26:45 +01:00
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="general-engine-configuration">
<span id="id1"></span><h2><a class="toc-backref" href="#id5">general engine configuration</a><a class="headerlink" href="#general-engine-configuration" title="Permalink to this headline"></a></h2>
<p>It is required to tell searx the type of results the engine provides. The
arguments can be set in the engine file or in the settings file
2019-12-30 18:31:17 +01:00
(normally <code class="docutils literal notranslate"><span class="pre">settings.yml</span></code>). The arguments in the settings file override
the ones in the engine file.</p>
<p>It does not matter if an option is stored in the engine file or in the
2019-12-30 18:31:17 +01:00
settings. However, the standard way is the following:</p>
<div class="section" id="engine-file">
<span id="id2"></span><h3><a class="toc-backref" href="#id6">engine file</a><a class="headerlink" href="#engine-file" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
<col style="width: 26%" />
<col style="width: 12%" />
<col style="width: 62%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>categories</p></td>
<td><p>list</p></td>
<td><p>pages, in which the engine is working</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>paging</p></td>
<td><p>boolean</p></td>
<td><p>support multible pages</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>time_range_support</p></td>
2019-12-30 18:31:17 +01:00
<td><p>boolean</p></td>
<td><p>support search time range</p></td>
2016-11-04 18:40:49 +01:00
</tr>
<tr class="row-odd"><td><p>engine_type</p></td>
<td><p>str</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">online</span></code> by default, other possibles values are
<code class="docutils literal notranslate"><span class="pre">offline</span></code>, <code class="docutils literal notranslate"><span class="pre">online_dictionnary</span></code>, <code class="docutils literal notranslate"><span class="pre">online_currency</span></code></p></td>
</tr>
2015-11-28 19:26:45 +01:00
</tbody>
</table>
</div>
<div class="section" id="settings-yml">
<span id="engine-settings"></span><h3><a class="toc-backref" href="#id7">settings.yml</a><a class="headerlink" href="#settings-yml" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2020-09-02 00:33:07 +02:00
<col style="width: 29%" />
2019-12-30 18:31:17 +01:00
<col style="width: 14%" />
2020-09-02 00:33:07 +02:00
<col style="width: 57%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>name</p></td>
<td><p>string</p></td>
<td><p>name of search-engine</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>engine</p></td>
<td><p>string</p></td>
<td><p>name of searx-engine
(filename without <code class="docutils literal notranslate"><span class="pre">.py</span></code>)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>enable_http</p></td>
<td><p>bool</p></td>
<td><p>enable HTTP
(by default only HTTPS is enabled).</p></td>
</tr>
<tr class="row-odd"><td><p>shortcut</p></td>
2019-12-30 18:31:17 +01:00
<td><p>string</p></td>
<td><p>shortcut of search-engine</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>timeout</p></td>
2019-12-30 18:31:17 +01:00
<td><p>string</p></td>
<td><p>specific timeout for search-engine</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-odd"><td><p>display_error_messages</p></td>
2020-06-19 11:15:15 +02:00
<td><p>boolean</p></td>
<td><p>display error messages on the web UI</p></td>
</tr>
<tr class="row-even"><td><p>proxies</p></td>
2020-09-02 00:33:07 +02:00
<td><p>dict</p></td>
<td><p>set proxies for a specific engine
(e.g. <code class="docutils literal notranslate"><span class="pre">proxies</span> <span class="pre">:</span> <span class="pre">{http:</span> <span class="pre">socks5://proxy:port,</span>
<span class="pre">https:</span> <span class="pre">socks5://proxy:port}</span></code>)</p></td>
</tr>
2015-11-28 19:26:45 +01:00
</tbody>
</table>
</div>
<div class="section" id="overrides">
<h3><a class="toc-backref" href="#id8">overrides</a><a class="headerlink" href="#overrides" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<p>A few of the options have default values in the engine, but are often
overwritten by the settings. If <code class="docutils literal notranslate"><span class="pre">None</span></code> is assigned to an option in the engine
file, it has to be redefined in the settings, otherwise searx will not start
with that engine.</p>
<p>The naming of overrides is arbitrary. But the recommended overrides are the
following:</p>
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 30%" />
<col style="width: 14%" />
<col style="width: 56%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>base_url</p></td>
<td><p>string</p></td>
<td><p>base-url, can be overwritten to use same
engine on other URL</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>number_of_results</p></td>
<td><p>int</p></td>
<td><p>maximum number of results per request</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>language</p></td>
<td><p>string</p></td>
<td><p>ISO code of language and country like en_US</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>api_key</p></td>
<td><p>string</p></td>
<td><p>api-key if required by engine</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
<div class="section" id="example-code">
<h3><a class="toc-backref" href="#id9">example code</a><a class="headerlink" href="#example-code" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># engine dependent config</span>
2016-11-04 21:56:14 +01:00
<span class="n">categories</span> <span class="o">=</span> <span class="p">[</span><span class="s1">&#39;general&#39;</span><span class="p">]</span>
<span class="n">paging</span> <span class="o">=</span> <span class="kc">True</span>
2015-11-28 19:26:45 +01:00
</pre></div>
</div>
</div>
</div>
<div class="section" id="making-a-request">
<h2><a class="toc-backref" href="#id10">making a request</a><a class="headerlink" href="#making-a-request" title="Permalink to this headline"></a></h2>
2019-12-30 18:31:17 +01:00
<p>To perform a search an URL have to be specified. In addition to specifying an
URL, arguments can be passed to the query.</p>
<div class="section" id="passed-arguments">
<h3><a class="toc-backref" href="#id11">passed arguments</a><a class="headerlink" href="#passed-arguments" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<p>These arguments can be used to construct the search query. Furthermore,
parameters with default value can be redefined for special purposes.</p>
<p>If the <code class="docutils literal notranslate"><span class="pre">engine_type</span></code> is <code class="docutils literal notranslate"><span class="pre">online`</span></code>:</p>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
<col style="width: 20%" />
<col style="width: 13%" />
<col style="width: 67%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>default-value, information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>url</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p><code class="docutils literal notranslate"><span class="pre">''</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>method</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p><code class="docutils literal notranslate"><span class="pre">'GET'</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>headers</p></td>
<td><p>set</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">{}</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>data</p></td>
<td><p>set</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">{}</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>cookies</p></td>
<td><p>set</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">{}</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>verify</p></td>
<td><p>bool</p></td>
2019-12-30 18:31:17 +01:00
<td><p><code class="docutils literal notranslate"><span class="pre">True</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>headers.User-Agent</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p>a random User-Agent</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>category</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p>current category, like <code class="docutils literal notranslate"><span class="pre">'general'</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>safesearch</p></td>
<td><p>int</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">0</span></code>, between <code class="docutils literal notranslate"><span class="pre">0</span></code> and <code class="docutils literal notranslate"><span class="pre">2</span></code> (normal, moderate, strict)</p></td>
</tr>
<tr class="row-odd"><td><p>time_range</p></td>
<td><p>Optional[str]</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">None</span></code>, can be <code class="docutils literal notranslate"><span class="pre">day</span></code>, <code class="docutils literal notranslate"><span class="pre">week</span></code>, <code class="docutils literal notranslate"><span class="pre">month</span></code>, <code class="docutils literal notranslate"><span class="pre">year</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>pageno</p></td>
2019-12-30 18:31:17 +01:00
<td><p>int</p></td>
<td><p>current pagenumber</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-odd"><td><p>language</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p>specific language code like <code class="docutils literal notranslate"><span class="pre">'en_US'</span></code>, or <code class="docutils literal notranslate"><span class="pre">'all'</span></code> if unspecified</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
<p>If the <code class="docutils literal notranslate"><span class="pre">engine_type</span></code> is <code class="docutils literal notranslate"><span class="pre">online_dictionnary`</span></code>, in addition to the <code class="docutils literal notranslate"><span class="pre">online</span></code> arguments:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 21%" />
<col style="width: 11%" />
<col style="width: 68%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>default-value, information</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>from_lang</p></td>
<td><p>str</p></td>
<td><p>specific language code like <code class="docutils literal notranslate"><span class="pre">'en_US'</span></code></p></td>
</tr>
<tr class="row-odd"><td><p>to_lang</p></td>
<td><p>str</p></td>
<td><p>specific language code like <code class="docutils literal notranslate"><span class="pre">'en_US'</span></code></p></td>
</tr>
<tr class="row-even"><td><p>query</p></td>
<td><p>str</p></td>
<td><p>the text query without the languages</p></td>
</tr>
</tbody>
</table>
<p>If the <code class="docutils literal notranslate"><span class="pre">engine_type</span></code> is <code class="docutils literal notranslate"><span class="pre">online_currency`</span></code>, in addition to the <code class="docutils literal notranslate"><span class="pre">online</span></code> arguments:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 21%" />
<col style="width: 11%" />
<col style="width: 68%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>default-value, information</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>amount</p></td>
<td><p>float</p></td>
<td><p>the amount to convert</p></td>
</tr>
<tr class="row-odd"><td><p>from</p></td>
<td><p>str</p></td>
<td><p>ISO 4217 code</p></td>
</tr>
<tr class="row-even"><td><p>to</p></td>
<td><p>str</p></td>
<td><p>ISO 4217 code</p></td>
</tr>
<tr class="row-odd"><td><p>from_name</p></td>
<td><p>str</p></td>
<td><p>currency name</p></td>
</tr>
<tr class="row-even"><td><p>to_name</p></td>
<td><p>str</p></td>
<td><p>currency name</p></td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="parsed-arguments">
<h3><a class="toc-backref" href="#id12">parsed arguments</a><a class="headerlink" href="#parsed-arguments" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<p>The function <code class="docutils literal notranslate"><span class="pre">def</span> <span class="pre">request(query,</span> <span class="pre">params):</span></code> always returns the <code class="docutils literal notranslate"><span class="pre">params</span></code>
variable. Inside searx, the following paramters can be used to specify a search
request:</p>
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
<col style="width: 18%" />
<col style="width: 11%" />
<col style="width: 71%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>argument</p></th>
<th class="head"><p>type</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>url</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p>requested url</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>method</p></td>
<td><p>str</p></td>
2019-12-30 18:31:17 +01:00
<td><p>HTTP request method</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>headers</p></td>
<td><p>set</p></td>
<td><p>HTTP header information</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>data</p></td>
<td><p>set</p></td>
<td><p>HTTP data information</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>cookies</p></td>
<td><p>set</p></td>
<td><p>HTTP cookies</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>verify</p></td>
<td><p>bool</p></td>
2019-12-30 18:31:17 +01:00
<td><p>Performing SSL-Validity check</p></td>
2015-11-28 19:26:45 +01:00
</tr>
<tr class="row-even"><td><p>allow_redirects</p></td>
<td><p>bool</p></td>
<td><p>Follow redirects</p></td>
</tr>
<tr class="row-odd"><td><p>max_redirects</p></td>
<td><p>int</p></td>
<td><p>maximum redirects, hard limit</p></td>
</tr>
<tr class="row-even"><td><p>soft_max_redirects</p></td>
<td><p>int</p></td>
<td><p>maximum redirects, soft limit. Record an error but dont stop the engine</p></td>
</tr>
<tr class="row-odd"><td><p>raise_for_httperror</p></td>
<td><p>bool</p></td>
<td><p>True by default: raise an exception if the HTTP code of response is &gt;= 300</p></td>
</tr>
2015-11-28 19:26:45 +01:00
</tbody>
</table>
</div>
<div class="section" id="id3">
<h3><a class="toc-backref" href="#id13">example code</a><a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># search-url</span>
2016-11-04 21:56:14 +01:00
<span class="n">base_url</span> <span class="o">=</span> <span class="s1">&#39;https://example.com/&#39;</span>
<span class="n">search_string</span> <span class="o">=</span> <span class="s1">&#39;search?</span><span class="si">{query}</span><span class="s1">&amp;page=</span><span class="si">{page}</span><span class="s1">&#39;</span>
2015-11-28 19:26:45 +01:00
2016-11-04 21:56:14 +01:00
<span class="c1"># do search-request</span>
2015-11-28 19:26:45 +01:00
<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>
<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>
2016-11-04 21:56:14 +01:00
<span class="n">query</span><span class="o">=</span><span class="n">urlencode</span><span class="p">({</span><span class="s1">&#39;q&#39;</span><span class="p">:</span> <span class="n">query</span><span class="p">}),</span>
<span class="n">page</span><span class="o">=</span><span class="n">params</span><span class="p">[</span><span class="s1">&#39;pageno&#39;</span><span class="p">])</span>
2015-11-28 19:26:45 +01:00
2016-11-04 21:56:14 +01:00
<span class="n">params</span><span class="p">[</span><span class="s1">&#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>
2015-11-28 19:26:45 +01:00
<span class="k">return</span> <span class="n">params</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="returned-results">
<h2><a class="toc-backref" href="#id14">returned results</a><a class="headerlink" href="#returned-results" title="Permalink to this headline"></a></h2>
2019-12-30 18:31:17 +01:00
<p>Searx is able to return results of different media-types. Currently the
following media-types are supported:</p>
2015-11-28 19:26:45 +01:00
<ul class="simple">
2019-12-30 18:31:17 +01:00
<li><p><a class="reference internal" href="#default">default</a></p></li>
<li><p><a class="reference internal" href="#images">images</a></p></li>
<li><p><a class="reference internal" href="#videos">videos</a></p></li>
<li><p><a class="reference internal" href="#torrent">torrent</a></p></li>
<li><p><a class="reference internal" href="#map">map</a></p></li>
2015-11-28 19:26:45 +01:00
</ul>
2019-12-30 18:31:17 +01:00
<p>To set another media-type as default, the parameter <code class="docutils literal notranslate"><span class="pre">template</span></code> must be set to
the desired type.</p>
<div class="section" id="default">
<h3><a class="toc-backref" href="#id15">default</a><a class="headerlink" href="#default" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 32%" />
<col style="width: 68%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>result-parameter</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>url</p></td>
<td><p>string, url of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>title</p></td>
<td><p>string, title of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>content</p></td>
<td><p>string, general result-text</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>publishedDate</p></td>
2020-10-08 14:19:38 +02:00
<td><p><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>, time of publish</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
<div class="section" id="images">
<h3><a class="toc-backref" href="#id16">images</a><a class="headerlink" href="#images" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<p>To use this template, the parameter:</p>
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 32%" />
<col style="width: 68%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>result-parameter</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>template</p></td>
<td><p>is set to <code class="docutils literal notranslate"><span class="pre">images.html</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>url</p></td>
<td><p>string, url to the result site</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>title</p></td>
<td><p>string, title of the result <em>(partly implemented)</em></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>content</p></td>
<td><p><em>(partly implemented)</em></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>publishedDate</p></td>
2020-10-08 14:19:38 +02:00
<td><p><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>,
2019-12-30 18:31:17 +01:00
time of publish <em>(partly implemented)</em></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>img_src</p></td>
<td><p>string, url to the result image</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>thumbnail_src</p></td>
<td><p>string, url to a small-preview image</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
<div class="section" id="videos">
<h3><a class="toc-backref" href="#id17">videos</a><a class="headerlink" href="#videos" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 32%" />
<col style="width: 68%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>result-parameter</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>template</p></td>
<td><p>is set to <code class="docutils literal notranslate"><span class="pre">videos.html</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>url</p></td>
<td><p>string, url of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>title</p></td>
<td><p>string, title of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>content</p></td>
<td><p><em>(not implemented yet)</em></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>publishedDate</p></td>
2020-10-08 14:19:38 +02:00
<td><p><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>, time of publish</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>thumbnail</p></td>
<td><p>string, url to a small-preview image</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
<div class="section" id="torrent">
<h3><a class="toc-backref" href="#id18">torrent</a><a class="headerlink" href="#torrent" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 32%" />
<col style="width: 68%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>result-parameter</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
2016-11-05 16:22:41 +01:00
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>template</p></td>
<td><p>is set to <code class="docutils literal notranslate"><span class="pre">torrent.html</span></code></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>url</p></td>
<td><p>string, url of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>title</p></td>
<td><p>string, title of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>content</p></td>
<td><p>string, general result-text</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>publishedDate</p></td>
2020-10-08 14:19:38 +02:00
<td><p><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>,
2019-12-30 18:31:17 +01:00
time of publish <em>(not implemented yet)</em></p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>seed</p></td>
<td><p>int, number of seeder</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>leech</p></td>
<td><p>int, number of leecher</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>filesize</p></td>
<td><p>int, size of file in bytes</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>files</p></td>
<td><p>int, number of files</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>magnetlink</p></td>
<td><p>string, <a class="reference external" href="https://en.wikipedia.org/wiki/Magnet_URI_scheme">magnetlink</a> of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>torrentfile</p></td>
<td><p>string, torrentfile of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
<div class="section" id="map">
<h3><a class="toc-backref" href="#id19">map</a><a class="headerlink" href="#map" title="Permalink to this headline"></a></h3>
2019-12-30 18:31:17 +01:00
<table class="docutils align-default">
2015-11-28 19:26:45 +01:00
<colgroup>
2019-12-30 18:31:17 +01:00
<col style="width: 32%" />
<col style="width: 68%" />
2015-11-28 19:26:45 +01:00
</colgroup>
2019-12-30 18:31:17 +01:00
<thead>
<tr class="row-odd"><th class="head"><p>result-parameter</p></th>
<th class="head"><p>information</p></th>
2015-11-28 19:26:45 +01:00
</tr>
</thead>
2019-12-30 18:31:17 +01:00
<tbody>
<tr class="row-even"><td><p>url</p></td>
<td><p>string, url of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>title</p></td>
<td><p>string, title of the result</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>content</p></td>
<td><p>string, general result-text</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>publishedDate</p></td>
2020-10-08 14:19:38 +02:00
<td><p><a class="reference external" href="https://docs.python.org/3/library/datetime.html#datetime.datetime" title="(in Python v3.9)"><code class="xref py py-class docutils literal notranslate"><span class="pre">datetime.datetime</span></code></a>, time of publish</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>latitude</p></td>
<td><p>latitude of result (in decimal format)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>longitude</p></td>
<td><p>longitude of result (in decimal format)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>boundingbox</p></td>
<td><p>boundingbox of result (array of 4. values
<code class="docutils literal notranslate"><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>)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>geojson</p></td>
<td><p>geojson of result (<a class="reference external" href="https://geojson.org/">https://geojson.org/</a>)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>osm.type</p></td>
<td><p>type of osm-object (if OSM-Result)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>osm.id</p></td>
<td><p>id of osm-object (if OSM-Result)</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>address.name</p></td>
<td><p>name of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>address.road</p></td>
<td><p>street name of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>address.house_number</p></td>
<td><p>house number of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>address.locality</p></td>
<td><p>city, place of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-even"><td><p>address.postcode</p></td>
<td><p>postcode of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
2019-12-30 18:31:17 +01:00
<tr class="row-odd"><td><p>address.country</p></td>
<td><p>country of object</p></td>
2015-11-28 19:26:45 +01:00
</tr>
</tbody>
</table>
</div>
</div>
</div>
2015-11-28 19:26:45 +01:00
2020-09-30 10:35:05 +02:00
<div class="clearer"></div>
2015-11-28 19:26:45 +01:00
</div>
</div>
</div>
2019-12-30 18:31:17 +01:00
<span id="sidebar-top"></span>
2015-11-28 19:26:45 +01:00
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
2019-12-30 18:31:17 +01:00
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
</a></p>
<h3>Project Links</h3>
<ul>
2020-09-30 10:35:05 +02:00
<li><a href="https://github.com/searx/searx">Source</a>
2019-12-30 18:31:17 +01:00
2020-09-30 10:35:05 +02:00
<li><a href="https://github.com/searx/searx/wiki">Wiki</a>
2019-12-30 18:31:17 +01:00
<li><a href="https://searx.space">Public instances</a>
2019-12-30 18:31:17 +01:00
<li><a href="https://twitter.com/Searx_engine">Twitter</a>
<li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
2019-12-30 18:31:17 +01:00
</ul><h3>Navigation</h3>
2015-11-28 19:26:45 +01:00
<ul>
2019-12-30 18:31:17 +01:00
<li><a href="../index.html">Overview</a>
<ul>
<li><a href="index.html">Developer documentation</a>
<ul>
<li>Previous: <a href="contribution_guide.html" title="previous chapter">How to contribute</a>
<li>Next: <a href="search_api.html" title="next chapter">Search API</a></ul>
</li>
</ul>
</li>
2015-11-28 19:26:45 +01:00
</ul>
2019-12-30 18:31:17 +01:00
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
2015-11-28 19:26:45 +01:00
</div>
2020-02-15 10:08:58 +01:00
<script>$('#searchbox').show(0);</script>
2015-11-28 19:26:45 +01:00
</div>
</div>
<div class="clearer"></div>
</div>
2019-12-30 18:31:17 +01:00
<div class="footer" role="contentinfo">
2020-02-20 19:32:55 +01:00
&#169; Copyright 2015-2020, Adam Tauber, Noémi Ványi.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.5.3.
2015-11-28 19:26:45 +01:00
</div>
2020-02-15 10:08:58 +01:00
<script src="../_static/version_warning_offset.js"></script>
2019-12-30 18:31:17 +01:00
2015-11-28 19:26:45 +01:00
</body>
</html>