This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<li><p><aclass="reference internal"href="offline/command-line-engines.html#engine-command"><spanclass="std std-ref">Command Line Engines</span></a></p></li>
<p>To extend the functionality of SearXNG, offline engines are going to be
introduced. An offline engine is an engine which does not need Internet
connection to perform a search and does not use HTTP to communicate.</p>
<p>Offline engines can be configured, by adding those to the <cite>engines</cite> list of
<aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/searx/settings.yml">settings.yml</a>. An example skeleton for offline
engines can be found in <aclass="reference internal"href="demo/demo_offline.html#demo-offline-engine"><spanclass="std std-ref">Demo Offline Engine</span></a> (<aclass="extlink-origin reference external"href="https://github.com/searxng/searxng/blob/master/searx/engines/demo_offline.py">demo_offline.py</a>).</p>
<sectionid="programming-interface">
<h2>Programming Interface<aclass="headerlink"href="#programming-interface"title="Link to this heading">¶</a></h2>
<dl>
<dt><aclass="reference internal"href="demo/demo_offline.html#searx.engines.demo_offline.init"title="searx.engines.demo_offline.init"><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">init(engine_settings=None)</span></code></a></dt><dd><p>All offline engines can have their own init function to setup the engine before
accepting requests. The function gets the settings from settings.yml as a
parameter. This function can be omitted, if there is no need to setup anything
in advance.</p>
</dd>
<dt><codeclass="xref py py-func docutils literal notranslate"><spanclass="pre">search(query,</span><spanclass="pre">params)</span></code></dt><dd><p>Each offline engine has a function named <codeclass="docutils literal notranslate"><spanclass="pre">search</span></code>. This function is
responsible to perform a search and return the results in a presentable
format. (Where <em>presentable</em> means presentable by the selected result
template.)</p>
<p>The return value is a list of results retrieved by the engine.</p>
</dd>
<dt>Engine representation in <codeclass="docutils literal notranslate"><spanclass="pre">/config</span></code></dt><dd><p>If an engine is offline, the attribute <codeclass="docutils literal notranslate"><spanclass="pre">offline</span></code> is set to <codeclass="docutils literal notranslate"><spanclass="pre">True</span></code>.</p>
</dd>
</dl>
</section>
<sectionid="extra-dependencies">
<spanid="offline-requirements"></span><h2>Extra Dependencies<aclass="headerlink"href="#extra-dependencies"title="Link to this heading">¶</a></h2>
<p>If an offline engine depends on an external tool, SearXNG does not install it by
default. When an administrator configures such engine and starts the instance,
the process returns an error with the list of missing dependencies. Also,
required dependencies will be added to the comment/description of the engine, so
admins can install packages in advance.</p>
<p>If there is a need to install additional packages in <em>Python’s Virtual
Environment</em> of your SearXNG instance you need to switch into the environment
(<aclass="reference internal"href="../../admin/installation-searxng.html#searxng-src"><spanclass="std std-ref">Install SearXNG & dependencies</span></a>) first, for this you can use <aclass="reference internal"href="../../utils/searxng.sh.html#searxng-sh"><spanclass="std std-ref">utils/searxng.sh</span></a>:</p>
<h2>Private engines (Security)<aclass="headerlink"href="#private-engines-security"title="Link to this heading">¶</a></h2>
<p>To limit the access to offline engines, if an instance is available publicly,
administrators can set token(s) for each of the <aclass="reference internal"href="../../admin/settings/settings_engine.html#private-engines"><spanclass="std std-ref">Private Engines (tokens)</span></a>. If a
query contains a valid token, then SearXNG performs the requested private
search. If not, requests from an offline engines return errors.</p>