diff options
Diffstat (limited to 'dev/engines/offline')
-rw-r--r-- | dev/engines/offline/command-line-engines.html | 249 | ||||
-rw-r--r-- | dev/engines/offline/nosql-engines.html | 300 | ||||
-rw-r--r-- | dev/engines/offline/search-indexer-engines.html | 289 | ||||
-rw-r--r-- | dev/engines/offline/sql-engines.html | 493 |
4 files changed, 1331 insertions, 0 deletions
diff --git a/dev/engines/offline/command-line-engines.html b/dev/engines/offline/command-line-engines.html new file mode 100644 index 000000000..f05bd025d --- /dev/null +++ b/dev/engines/offline/command-line-engines.html @@ -0,0 +1,249 @@ +<!DOCTYPE html> + +<html lang="en" data-content_root="../../../"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Command Line Engines — SearXNG Documentation (2025.1.6+6dab7fe78)</title> + <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=4f649999" /> + <link rel="stylesheet" type="text/css" href="../../../_static/searxng.css?v=52e4ff28" /> + <script src="../../../_static/documentation_options.js?v=ef740023"></script> + <script src="../../../_static/doctools.js?v=9a2dae69"></script> + <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> + <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../_static/describe_version.js?v=fa7f30d0"></script> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link rel="next" title="NoSQL databases" href="nosql-engines.html" /> + <link rel="prev" title="Demo Offline Engine" href="../demo/demo_offline.html" /> + </head><body> + <div class="related" role="navigation" aria-label="Related"> + <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> + <li class="right" > + <a href="nosql-engines.html" title="NoSQL databases" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="../demo/demo_offline.html" title="Demo Offline Engine" + accesskey="P">previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> »</li> + <li class="nav-item nav-item-1"><a href="../../index.html" >Developer documentation</a> »</li> + <li class="nav-item nav-item-2"><a href="../index.html" accesskey="U">Engine Implementations</a> »</li> + <li class="nav-item nav-item-this"><a href="">Command Line Engines</a></li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + + <section id="command-line-engines"> +<span id="engine-command"></span><h1>Command Line Engines<a class="headerlink" href="#command-line-engines" title="Link to this heading">¶</a></h1> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/command.py">command.py</a></p></li> +<li><p><a class="reference internal" href="../index.html#offline-engines"><span class="std std-ref">Offline Engines</span></a></p></li> +</ul> +</aside> +<nav class="contents local" id="contents"> +<ul class="simple"> +<li><p><a class="reference internal" href="#configuration" id="id1">Configuration</a></p></li> +<li><p><a class="reference internal" href="#example" id="id2">Example</a></p></li> +<li><p><a class="reference internal" href="#implementations" id="id3">Implementations</a></p></li> +</ul> +</nav> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<p>Initial sponsored by <a class="reference external" href="https://nlnet.nl/discovery">Search and Discovery Fund</a> of <a class="reference external" href="https://nlnet.nl/">NLnet Foundation</a>.</p> +</aside> +<p id="module-searx.engines.command">With <em>command engines</em> administrators can run engines to integrate arbitrary +shell commands.</p> +<div class="admonition attention"> +<p class="admonition-title">Attention</p> +<p>When creating and enabling a <code class="docutils literal notranslate"><span class="pre">command</span></code> engine on a public instance, you +must be careful to avoid leaking private data.</p> +</div> +<p>The easiest solution is to limit the access by setting <code class="docutils literal notranslate"><span class="pre">tokens</span></code> as described +in section <a class="reference internal" href="../../../admin/settings/settings_engine.html#private-engines"><span class="std std-ref">Private Engines (tokens)</span></a>. The engine base is flexible. Only your +imagination can limit the power of this engine (and maybe security concerns).</p> +<section id="configuration"> +<h2><a class="toc-backref" href="#id1" role="doc-backlink">Configuration</a><a class="headerlink" href="#configuration" title="Link to this heading">¶</a></h2> +<p>The following options are available:</p> +<dl> +<dt><code class="docutils literal notranslate"><span class="pre">command</span></code>:</dt><dd><p>A comma separated list of the elements of the command. A special token +<code class="docutils literal notranslate"><span class="pre">{{QUERY}}</span></code> tells where to put the search terms of the user. Example:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">[</span><span class="s">'ls'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'-l'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'-h'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'{{QUERY}}'</span><span class="p p-Indicator">]</span> +</pre></div> +</div> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">delimiter</span></code>:</dt><dd><p>A mapping containing a delimiter <code class="docutils literal notranslate"><span class="pre">char</span></code> and the <em>titles</em> of each element in +<code class="docutils literal notranslate"><span class="pre">keys</span></code>.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">parse_regex</span></code>:</dt><dd><p>A dict containing the regular expressions for each result key.</p> +</dd> +</dl> +<p><code class="docutils literal notranslate"><span class="pre">query_type</span></code>:</p> +<blockquote> +<div><p>The expected type of user search terms. Possible values: <code class="docutils literal notranslate"><span class="pre">path</span></code> and +<code class="docutils literal notranslate"><span class="pre">enum</span></code>.</p> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">path</span></code>:</dt><dd><p>Checks if the user provided path is inside the working directory. If not, +the query is not executed.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">enum</span></code>:</dt><dd><p>Is a list of allowed search terms. If the user submits something which is +not included in the list, the query returns an error.</p> +</dd> +</dl> +</div></blockquote> +<dl class="simple"> +<dt><code class="docutils literal notranslate"><span class="pre">query_enum</span></code>:</dt><dd><p>A list containing allowed search terms if <code class="docutils literal notranslate"><span class="pre">query_type</span></code> is set to <code class="docutils literal notranslate"><span class="pre">enum</span></code>.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">working_dir</span></code>:</dt><dd><p>The directory where the command has to be executed. Default: <code class="docutils literal notranslate"><span class="pre">./</span></code>.</p> +</dd> +<dt><code class="docutils literal notranslate"><span class="pre">result_separator</span></code>:</dt><dd><p>The character that separates results. Default: <code class="docutils literal notranslate"><span class="pre">\n</span></code>.</p> +</dd> +</dl> +</section> +<section id="example"> +<h2><a class="toc-backref" href="#id2" role="doc-backlink">Example</a><a class="headerlink" href="#example" title="Link to this heading">¶</a></h2> +<p>The example engine below can be used to find files with a specific name in the +configured working directory:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">find</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">command</span> +<span class="w"> </span><span class="nt">command</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'find'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'.'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'-name'</span><span class="p p-Indicator">,</span><span class="w"> </span><span class="s">'{{QUERY}}'</span><span class="p p-Indicator">]</span> +<span class="w"> </span><span class="nt">query_type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">path</span> +<span class="w"> </span><span class="nt">shortcut</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">fnd</span> +<span class="w"> </span><span class="nt">delimiter</span><span class="p">:</span> +<span class="w"> </span><span class="nt">chars</span><span class="p">:</span><span class="w"> </span><span class="s">'</span><span class="nv"> </span><span class="s">'</span> +<span class="w"> </span><span class="nt">keys</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">[</span><span class="s">'line'</span><span class="p p-Indicator">]</span> +</pre></div> +</div> +</section> +<section id="implementations"> +<h2><a class="toc-backref" href="#id3" role="doc-backlink">Implementations</a><a class="headerlink" href="#implementations" title="Link to this heading">¶</a></h2> +</section> +<dl class="py function"> +<dt class="sig sig-object py" id="searx.engines.command.check_parsing_options"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.command.</span></span><span class="sig-name descname"><span class="pre">check_parsing_options</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">engine_settings</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/searx/engines/command.html#check_parsing_options"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#searx.engines.command.check_parsing_options" title="Link to this definition">¶</a></dt> +<dd><p>Checks if delimiter based parsing or regex parsing is configured correctly</p> +</dd></dl> + +</section> + + + <div class="clearer"></div> + </div> + </div> + </div> + <span id="sidebar-top"></span> + <div class="sphinxsidebar" role="navigation" aria-label="Main"> + <div class="sphinxsidebarwrapper"> + + + <p class="logo"><a href="../../../index.html"> + <img class="logo" src="../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/> + </a></p> + + +<h3><a href="../../../index.html">Table of Contents</a></h3> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="../../../user/index.html">User information</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../own-instance.html">Why use a private instance?</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../admin/index.html">Administrator documentation</a></li> +<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Developer documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="../../quickstart.html">Development Quickstart</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../rtm_asdf.html">Runtime Management</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../contribution_guide.html">How to contribute</a></li> +<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Engine Implementations</a><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="../enginelib.html">Engine Library</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engines.html">SearXNG’s engines loader</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engine_overview.html">Engine Overview</a></li> +<li class="toctree-l3 current"><a class="reference internal" href="../index.html#engine-types">Engine Types</a><ul class="current"> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-engines">Online Engines</a></li> +<li class="toctree-l4 current"><a class="reference internal" href="../index.html#offline-engines">Offline Engines</a><ul class="current"> +<li class="toctree-l5"><a class="reference internal" href="../offline_concept.html">Offline Concept</a></li> +<li class="toctree-l5"><a class="reference internal" href="../demo/demo_offline.html">Demo Offline Engine</a></li> +<li class="toctree-l5 current"><a class="current reference internal" href="#">Command Line Engines</a></li> +<li class="toctree-l5"><a class="reference internal" href="nosql-engines.html">NoSQL databases</a></li> +<li class="toctree-l5"><a class="reference internal" href="search-indexer-engines.html">Local Search APIs</a></li> +<li class="toctree-l5"><a class="reference internal" href="sql-engines.html">SQL Engines</a></li> +</ul> +</li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-url-search">Online URL Search</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-currency">Online Currency</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-dictionary">Online Dictionary</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="../../search_api.html">Search API</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../plugins.html">Plugins</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../translation.html">Translation</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../lxcdev.html">Developing in Linux Containers</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../makefile.html">Makefile & <code class="docutils literal notranslate"><span class="pre">./manage</span></code></a></li> +<li class="toctree-l2"><a class="reference internal" href="../../reST.html">reST primer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../../../utils/index.html">DevOps tooling box</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../src/index.html">Source-Code</a></li> +</ul> + + <h3>Project Links</h3> + <ul> + <li><a href="https://github.com/searxng/searxng/tree/master">Source</a> + + <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a> + + <li><a href="https://searx.space">Public instances</a> + + <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a> + </ul><h3>Navigation</h3> +<ul> + <li><a href="../../../index.html">Overview</a> + <ul> + <li><a href="../../index.html">Developer documentation</a> + <ul> + <li><a href="../index.html">Engine Implementations</a> + <ul> + <li>Previous: <a href="../demo/demo_offline.html" title="previous chapter">Demo Offline Engine</a> + <li>Next: <a href="nosql-engines.html" title="next chapter">NoSQL databases</a></ul> + </li></ul> + </li> + </ul> + </li> +</ul> +<search 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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> + <input type="submit" value="Go" /> + </form> + </div> +</search> +<script>document.getElementById('searchbox').style.display = "block"</script> + <div role="note" aria-label="source link"> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../../_sources/dev/engines/offline/command-line-engines.rst.txt" + rel="nofollow">Show Source</a></li> + </ul> + </div> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="footer" role="contentinfo"> + © Copyright SearXNG team. + </div> + </body> +</html>
\ No newline at end of file diff --git a/dev/engines/offline/nosql-engines.html b/dev/engines/offline/nosql-engines.html new file mode 100644 index 000000000..f180f0db2 --- /dev/null +++ b/dev/engines/offline/nosql-engines.html @@ -0,0 +1,300 @@ +<!DOCTYPE html> + +<html lang="en" data-content_root="../../../"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>NoSQL databases — SearXNG Documentation (2025.1.6+6dab7fe78)</title> + <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=4f649999" /> + <link rel="stylesheet" type="text/css" href="../../../_static/searxng.css?v=52e4ff28" /> + <script src="../../../_static/documentation_options.js?v=ef740023"></script> + <script src="../../../_static/doctools.js?v=9a2dae69"></script> + <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> + <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../_static/describe_version.js?v=fa7f30d0"></script> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link rel="next" title="Local Search APIs" href="search-indexer-engines.html" /> + <link rel="prev" title="Command Line Engines" href="command-line-engines.html" /> + </head><body> + <div class="related" role="navigation" aria-label="Related"> + <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> + <li class="right" > + <a href="search-indexer-engines.html" title="Local Search APIs" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="command-line-engines.html" title="Command Line Engines" + accesskey="P">previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> »</li> + <li class="nav-item nav-item-1"><a href="../../index.html" >Developer documentation</a> »</li> + <li class="nav-item nav-item-2"><a href="../index.html" accesskey="U">Engine Implementations</a> »</li> + <li class="nav-item nav-item-this"><a href="">NoSQL databases</a></li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + + <section id="nosql-databases"> +<span id="nosql-engines"></span><h1>NoSQL databases<a class="headerlink" href="#nosql-databases" title="Link to this heading">¶</a></h1> +<aside class="sidebar"> +<p class="sidebar-title">further read</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://en.wikipedia.org/wiki/NoSQL">NoSQL databases</a></p></li> +<li><p><a class="reference external" href="https://redis.io/">redis.io</a></p></li> +<li><p><a class="reference external" href="https://www.mongodb.com">MongoDB</a></p></li> +</ul> +</aside> +<nav class="contents local" id="contents"> +<ul class="simple"> +<li><p><a class="reference internal" href="#extra-dependencies" id="id6">Extra Dependencies</a></p></li> +<li><p><a class="reference internal" href="#configure-the-engines" id="id7">Configure the engines</a></p> +<ul> +<li><p><a class="reference internal" href="#redis-server" id="id8">Redis Server</a></p></li> +<li><p><a class="reference internal" href="#engine-mongodb" id="id9">MongoDB</a></p></li> +</ul> +</li> +</ul> +</nav> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<p>Initial sponsored by <a class="reference external" href="https://nlnet.nl/discovery">Search and Discovery Fund</a> of <a class="reference external" href="https://nlnet.nl/">NLnet Foundation</a>.</p> +</aside> +<p>The following <a class="reference external" href="https://en.wikipedia.org/wiki/NoSQL">NoSQL databases</a> are supported:</p> +<ul class="simple"> +<li><p><a class="reference internal" href="#engine-redis-server"><span class="std std-ref">Redis Server</span></a></p></li> +<li><p><a class="reference internal" href="#engine-mongodb"><span class="std std-ref">MongoDB</span></a></p></li> +</ul> +<p>All of the engines above are just commented out in the <a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/settings.yml">settings.yml</a>, as you have to set various options and install +dependencies before using them.</p> +<p>By default, the engines use the <code class="docutils literal notranslate"><span class="pre">key-value</span></code> template for displaying results / +see <a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/templates/simple/result_templates/key-value.html">simple</a> +theme. If you are not satisfied with the original result layout, you can use +your own template, set <code class="docutils literal notranslate"><span class="pre">result_template</span></code> attribute to <code class="docutils literal notranslate"><span class="pre">{template_name}</span></code> and +place the templates at:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">searx</span><span class="o">/</span><span class="n">templates</span><span class="o">/</span><span class="p">{</span><span class="n">theme_name</span><span class="p">}</span><span class="o">/</span><span class="n">result_templates</span><span class="o">/</span><span class="p">{</span><span class="n">template_name</span><span class="p">}</span> +</pre></div> +</div> +<p>Furthermore, if you do not wish to expose these engines on a public instance, you +can still add them and limit the access by setting <code class="docutils literal notranslate"><span class="pre">tokens</span></code> as described in +section <a class="reference internal" href="../../../admin/settings/settings_engine.html#private-engines"><span class="std std-ref">Private Engines (tokens)</span></a>.</p> +<section id="extra-dependencies"> +<h2><a class="toc-backref" href="#id6" role="doc-backlink">Extra Dependencies</a><a class="headerlink" href="#extra-dependencies" title="Link to this heading">¶</a></h2> +<p>For using <a class="reference internal" href="#engine-redis-server"><span class="std std-ref">Redis Server</span></a> or <a class="reference internal" href="#engine-mongodb"><span class="std std-ref">MongoDB</span></a> you need to +install additional packages in Python’s Virtual Environment of your SearXNG +instance. To switch into the environment (<a class="reference internal" href="../../../admin/installation-searxng.html#searxng-src"><span class="std std-ref">Install SearXNG & dependencies</span></a>) you can use +<a class="reference internal" href="../../../utils/searxng.sh.html#searxng-sh"><span class="std std-ref">utils/searxng.sh</span></a>:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sudo utils/searxng.sh instance cmd bash +(searxng-pyenv)$ pip install ... +</pre></div> +</div> +</section> +<section id="configure-the-engines"> +<h2><a class="toc-backref" href="#id7" role="doc-backlink">Configure the engines</a><a class="headerlink" href="#configure-the-engines" title="Link to this heading">¶</a></h2> +<p><a class="reference external" href="https://en.wikipedia.org/wiki/NoSQL">NoSQL databases</a> are used for storing arbitrary data without first defining +their structure.</p> +<section id="redis-server"> +<span id="engine-redis-server"></span><h3><a class="toc-backref" href="#id8" role="doc-backlink">Redis Server</a><a class="headerlink" href="#redis-server" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span></code> <a class="reference external" href="https://github.com/andymccurdy/redis-py#installation">redis</a></p></li> +<li><p><a class="reference external" href="https://redis.io/">redis.io</a></p></li> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/redis_server.py">redis_server.py</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.redis_server">Redis is an open source (BSD licensed), in-memory data structure (key value +based) store. Before configuring the <code class="docutils literal notranslate"><span class="pre">redis_server</span></code> engine, you must install +the dependency <a class="reference external" href="https://github.com/andymccurdy/redis-py#installation">redis</a>.</p> +<section id="configuration"> +<h4>Configuration<a class="headerlink" href="#configuration" title="Link to this heading">¶</a></h4> +<p>Select a database to search in and set its index in the option <code class="docutils literal notranslate"><span class="pre">db</span></code>. You can +either look for exact matches or use partial keywords to find what you are +looking for by configuring <code class="docutils literal notranslate"><span class="pre">exact_match_only</span></code>.</p> +</section> +<section id="example"> +<h4>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h4> +<p>Below is an example configuration:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="c1"># Required dependency: redis</span> + +<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">myredis</span> +<span class="w"> </span><span class="nt">shortcut </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">rds</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">redis_server</span> +<span class="w"> </span><span class="nt">exact_match_only</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span> +<span class="w"> </span><span class="nt">host</span><span class="p">:</span><span class="w"> </span><span class="s">'127.0.0.1'</span> +<span class="w"> </span><span class="nt">port</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">6379</span> +<span class="w"> </span><span class="nt">enable_http</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> +<span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="s">''</span> +<span class="w"> </span><span class="nt">db</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">0</span> +</pre></div> +</div> +</section> +<section id="implementations"> +<h4>Implementations<a class="headerlink" href="#implementations" title="Link to this heading">¶</a></h4> +</section> +</section> +<section id="engine-mongodb"> +<span id="id2"></span><h3><a class="toc-backref" href="#id9" role="doc-backlink">MongoDB</a><a class="headerlink" href="#engine-mongodb" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span></code> <a class="reference external" href="https://github.com/mongodb/mongo-python-driver#installation">pymongo</a></p></li> +<li><p><a class="reference external" href="https://www.mongodb.com">MongoDB</a></p></li> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/mongodb.py">mongodb.py</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.mongodb"><a class="reference external" href="https://www.mongodb.com">MongoDB</a> is a document based database program that handles JSON like data. +Before configuring the <code class="docutils literal notranslate"><span class="pre">mongodb</span></code> engine, you must install the dependency +<a class="reference external" href="https://github.com/mongodb/mongo-python-driver#installation">pymongo</a>.</p> +<section id="id3"> +<h4>Configuration<a class="headerlink" href="#id3" title="Link to this heading">¶</a></h4> +<p>In order to query <a class="reference external" href="https://www.mongodb.com">MongoDB</a>, you have to select a <code class="docutils literal notranslate"><span class="pre">database</span></code> and a +<code class="docutils literal notranslate"><span class="pre">collection</span></code>. Furthermore, you have to select a <code class="docutils literal notranslate"><span class="pre">key</span></code> that is going to be +searched. <a class="reference external" href="https://www.mongodb.com">MongoDB</a> also supports the option <code class="docutils literal notranslate"><span class="pre">exact_match_only</span></code>, so configure +it as you wish.</p> +</section> +<section id="id4"> +<h4>Example<a class="headerlink" href="#id4" title="Link to this heading">¶</a></h4> +<p>Below is an example configuration for using a MongoDB collection:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="c1"># MongoDB engine</span> +<span class="c1"># Required dependency: pymongo</span> + +<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mymongo</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mongodb</span> +<span class="w"> </span><span class="nt">shortcut</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">md</span> +<span class="w"> </span><span class="nt">exact_match_only</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span> +<span class="w"> </span><span class="nt">host</span><span class="p">:</span><span class="w"> </span><span class="s">'127.0.0.1'</span> +<span class="w"> </span><span class="nt">port</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">27017</span> +<span class="w"> </span><span class="nt">enable_http</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> +<span class="w"> </span><span class="nt">results_per_page</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">20</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="s">'business'</span> +<span class="w"> </span><span class="nt">collection</span><span class="p">:</span><span class="w"> </span><span class="s">'reviews'</span><span class="w"> </span><span class="c1"># name of the db collection</span> +<span class="w"> </span><span class="nt">key</span><span class="p">:</span><span class="w"> </span><span class="s">'name'</span><span class="w"> </span><span class="c1"># key in the collection to search for</span> +</pre></div> +</div> +</section> +<section id="id5"> +<h4>Implementations<a class="headerlink" href="#id5" title="Link to this heading">¶</a></h4> +</section> +</section> +</section> +</section> + + + <div class="clearer"></div> + </div> + </div> + </div> + <span id="sidebar-top"></span> + <div class="sphinxsidebar" role="navigation" aria-label="Main"> + <div class="sphinxsidebarwrapper"> + + + <p class="logo"><a href="../../../index.html"> + <img class="logo" src="../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/> + </a></p> + + +<h3><a href="../../../index.html">Table of Contents</a></h3> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="../../../user/index.html">User information</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../own-instance.html">Why use a private instance?</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../admin/index.html">Administrator documentation</a></li> +<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Developer documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="../../quickstart.html">Development Quickstart</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../rtm_asdf.html">Runtime Management</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../contribution_guide.html">How to contribute</a></li> +<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Engine Implementations</a><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="../enginelib.html">Engine Library</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engines.html">SearXNG’s engines loader</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engine_overview.html">Engine Overview</a></li> +<li class="toctree-l3 current"><a class="reference internal" href="../index.html#engine-types">Engine Types</a><ul class="current"> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-engines">Online Engines</a></li> +<li class="toctree-l4 current"><a class="reference internal" href="../index.html#offline-engines">Offline Engines</a><ul class="current"> +<li class="toctree-l5"><a class="reference internal" href="../offline_concept.html">Offline Concept</a></li> +<li class="toctree-l5"><a class="reference internal" href="../demo/demo_offline.html">Demo Offline Engine</a></li> +<li class="toctree-l5"><a class="reference internal" href="command-line-engines.html">Command Line Engines</a></li> +<li class="toctree-l5 current"><a class="current reference internal" href="#">NoSQL databases</a></li> +<li class="toctree-l5"><a class="reference internal" href="search-indexer-engines.html">Local Search APIs</a></li> +<li class="toctree-l5"><a class="reference internal" href="sql-engines.html">SQL Engines</a></li> +</ul> +</li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-url-search">Online URL Search</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-currency">Online Currency</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-dictionary">Online Dictionary</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="../../search_api.html">Search API</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../plugins.html">Plugins</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../translation.html">Translation</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../lxcdev.html">Developing in Linux Containers</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../makefile.html">Makefile & <code class="docutils literal notranslate"><span class="pre">./manage</span></code></a></li> +<li class="toctree-l2"><a class="reference internal" href="../../reST.html">reST primer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../../../utils/index.html">DevOps tooling box</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../src/index.html">Source-Code</a></li> +</ul> + + <h3>Project Links</h3> + <ul> + <li><a href="https://github.com/searxng/searxng/tree/master">Source</a> + + <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a> + + <li><a href="https://searx.space">Public instances</a> + + <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a> + </ul><h3>Navigation</h3> +<ul> + <li><a href="../../../index.html">Overview</a> + <ul> + <li><a href="../../index.html">Developer documentation</a> + <ul> + <li><a href="../index.html">Engine Implementations</a> + <ul> + <li>Previous: <a href="command-line-engines.html" title="previous chapter">Command Line Engines</a> + <li>Next: <a href="search-indexer-engines.html" title="next chapter">Local Search APIs</a></ul> + </li></ul> + </li> + </ul> + </li> +</ul> +<search 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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> + <input type="submit" value="Go" /> + </form> + </div> +</search> +<script>document.getElementById('searchbox').style.display = "block"</script> + <div role="note" aria-label="source link"> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../../_sources/dev/engines/offline/nosql-engines.rst.txt" + rel="nofollow">Show Source</a></li> + </ul> + </div> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="footer" role="contentinfo"> + © Copyright SearXNG team. + </div> + </body> +</html>
\ No newline at end of file diff --git a/dev/engines/offline/search-indexer-engines.html b/dev/engines/offline/search-indexer-engines.html new file mode 100644 index 000000000..036781dc6 --- /dev/null +++ b/dev/engines/offline/search-indexer-engines.html @@ -0,0 +1,289 @@ +<!DOCTYPE html> + +<html lang="en" data-content_root="../../../"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>Local Search APIs — SearXNG Documentation (2025.1.6+6dab7fe78)</title> + <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=4f649999" /> + <link rel="stylesheet" type="text/css" href="../../../_static/searxng.css?v=52e4ff28" /> + <script src="../../../_static/documentation_options.js?v=ef740023"></script> + <script src="../../../_static/doctools.js?v=9a2dae69"></script> + <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> + <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../_static/describe_version.js?v=fa7f30d0"></script> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link rel="next" title="SQL Engines" href="sql-engines.html" /> + <link rel="prev" title="NoSQL databases" href="nosql-engines.html" /> + </head><body> + <div class="related" role="navigation" aria-label="Related"> + <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> + <li class="right" > + <a href="sql-engines.html" title="SQL Engines" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="nosql-engines.html" title="NoSQL databases" + accesskey="P">previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> »</li> + <li class="nav-item nav-item-1"><a href="../../index.html" >Developer documentation</a> »</li> + <li class="nav-item nav-item-2"><a href="../index.html" accesskey="U">Engine Implementations</a> »</li> + <li class="nav-item nav-item-this"><a href="">Local Search APIs</a></li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + + <section id="local-search-apis"> +<h1>Local Search APIs<a class="headerlink" href="#local-search-apis" title="Link to this heading">¶</a></h1> +<aside class="sidebar"> +<p class="sidebar-title">further read</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://docs.meilisearch.com/learn/what_is_meilisearch/comparison_to_alternatives.html">Comparison to alternatives</a></p></li> +</ul> +</aside> +<nav class="contents local" id="contents"> +<ul class="simple"> +<li><p><a class="reference internal" href="#module-searx.engines.meilisearch" id="id6">MeiliSearch</a></p></li> +<li><p><a class="reference internal" href="#module-searx.engines.elasticsearch" id="id7">Elasticsearch</a></p></li> +<li><p><a class="reference internal" href="#module-searx.engines.solr" id="id8">Solr</a></p></li> +</ul> +</nav> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<p>Initial sponsored by <a class="reference external" href="https://nlnet.nl/discovery">Search and Discovery Fund</a> of <a class="reference external" href="https://nlnet.nl/">NLnet Foundation</a>.</p> +</aside> +<p>Administrators might find themselves wanting to integrate locally running search +engines. The following ones are supported for now:</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://www.elastic.co/elasticsearch/">Elasticsearch</a></p></li> +<li><p><a class="reference external" href="https://www.meilisearch.com">Meilisearch</a></p></li> +<li><p><a class="reference external" href="https://solr.apache.org">Solr</a></p></li> +</ul> +<p>Each search engine is powerful, capable of full-text search. All of the engines +above are added to <code class="docutils literal notranslate"><span class="pre">settings.yml</span></code> just commented out, as you have to +<code class="docutils literal notranslate"><span class="pre">base_url</span></code> for all them.</p> +<p>Please note that if you are not using HTTPS to access these engines, you have to +enable HTTP requests by setting <code class="docutils literal notranslate"><span class="pre">enable_http</span></code> to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p> +<p>Furthermore, if you do not want to expose these engines on a public instance, +you can still add them and limit the access by setting <code class="docutils literal notranslate"><span class="pre">tokens</span></code> as described +in section <a class="reference internal" href="../../../admin/settings/settings_engine.html#private-engines"><span class="std std-ref">Private Engines (tokens)</span></a>.</p> +<section id="module-searx.engines.meilisearch"> +<span id="meilisearch"></span><span id="engine-meilisearch"></span><h2><a class="toc-backref" href="#id6" role="doc-backlink">MeiliSearch</a><a class="headerlink" href="#module-searx.engines.meilisearch" title="Link to this heading">¶</a></h2> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/meilisearch.py">meilisearch.py</a></p></li> +<li><p><a class="reference external" href="https://www.meilisearch.com">MeiliSearch</a></p></li> +<li><p><a class="reference external" href="https://docs.meilisearch.com/">MeiliSearch Documentation</a></p></li> +<li><p><a class="reference external" href="https://docs.meilisearch.com/learn/getting_started/installation.html">Install MeiliSearch</a></p></li> +</ul> +</aside> +<p><a class="reference external" href="https://www.meilisearch.com">MeiliSearch</a> is aimed at individuals and small companies. It is designed for +small-scale (less than 10 million documents) data collections. E.g. it is great +for storing web pages you have visited and searching in the contents later.</p> +<p>The engine supports faceted search, so you can search in a subset of documents +of the collection. Furthermore, you can search in <a class="reference external" href="https://www.meilisearch.com">MeiliSearch</a> instances that +require authentication by setting <code class="docutils literal notranslate"><span class="pre">auth_token</span></code>.</p> +<section id="example"> +<h3>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h3> +<p>Here is a simple example to query a Meilisearch instance:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">meilisearch</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">meilisearch</span> +<span class="w"> </span><span class="nt">shortcut</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mes</span> +<span class="w"> </span><span class="nt">base_url</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">http://localhost:7700</span> +<span class="w"> </span><span class="nt">index</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my-index</span> +<span class="w"> </span><span class="nt">enable_http</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> +</pre></div> +</div> +</section> +</section> +<section id="module-searx.engines.elasticsearch"> +<span id="elasticsearch"></span><span id="engine-elasticsearch"></span><h2><a class="toc-backref" href="#id7" role="doc-backlink">Elasticsearch</a><a class="headerlink" href="#module-searx.engines.elasticsearch" title="Link to this heading">¶</a></h2> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/elasticsearch.py">elasticsearch.py</a></p></li> +<li><p><a class="reference external" href="https://www.elastic.co/elasticsearch/">Elasticsearch</a></p></li> +<li><p><a class="reference external" href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html">Elasticsearch Guide</a></p></li> +<li><p><a class="reference external" href="https://www.elastic.co/guide/en/elasticsearch/reference/current/install-elasticsearch.html">Install Elasticsearch</a></p></li> +</ul> +</aside> +<p><a class="reference external" href="https://www.elastic.co/elasticsearch/">Elasticsearch</a> supports numerous ways to query the data it is storing. At the +moment the engine supports the most popular search methods (<code class="docutils literal notranslate"><span class="pre">query_type</span></code>):</p> +<ul class="simple"> +<li><p><code class="docutils literal notranslate"><span class="pre">match</span></code>,</p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">simple_query_string</span></code>,</p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">term</span></code> and</p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">terms</span></code>.</p></li> +</ul> +<p>If none of the methods fit your use case, you can select <code class="docutils literal notranslate"><span class="pre">custom</span></code> query type +and provide the JSON payload to submit to Elasticsearch in +<code class="docutils literal notranslate"><span class="pre">custom_query_json</span></code>.</p> +<section id="id3"> +<h3>Example<a class="headerlink" href="#id3" title="Link to this heading">¶</a></h3> +<p>The following is an example configuration for an <a class="reference external" href="https://www.elastic.co/elasticsearch/">Elasticsearch</a> instance with +authentication configured to read from <code class="docutils literal notranslate"><span class="pre">my-index</span></code> index.</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">elasticsearch</span> +<span class="w"> </span><span class="nt">shortcut</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">es</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">elasticsearch</span> +<span class="w"> </span><span class="nt">base_url</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">http://localhost:9200</span> +<span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">elastic</span> +<span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">changeme</span> +<span class="w"> </span><span class="nt">index</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my-index</span> +<span class="w"> </span><span class="nt">query_type</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">match</span> +<span class="w"> </span><span class="c1"># custom_query_json: '{ ... }'</span> +<span class="w"> </span><span class="nt">enable_http</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> +</pre></div> +</div> +</section> +</section> +<section id="module-searx.engines.solr"> +<span id="solr"></span><span id="engine-solr"></span><h2><a class="toc-backref" href="#id8" role="doc-backlink">Solr</a><a class="headerlink" href="#module-searx.engines.solr" title="Link to this heading">¶</a></h2> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/solr.py">solr.py</a></p></li> +<li><p><a class="reference external" href="https://solr.apache.org">Solr</a></p></li> +<li><p><a class="reference external" href="https://solr.apache.org/resources.html">Solr Resources</a></p></li> +<li><p><a class="reference external" href="https://solr.apache.org/guide/installing-solr.html">Install Solr</a></p></li> +</ul> +</aside> +<p><a class="reference external" href="https://solr.apache.org">Solr</a> is a popular search engine based on Lucene, just like <a class="reference external" href="https://www.elastic.co/elasticsearch/">Elasticsearch</a>. But +instead of searching in indices, you can search in collections.</p> +<section id="id5"> +<h3>Example<a class="headerlink" href="#id5" title="Link to this heading">¶</a></h3> +<p>This is an example configuration for searching in the collection +<code class="docutils literal notranslate"><span class="pre">my-collection</span></code> and get the results in ascending order.</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">solr</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">solr</span> +<span class="w"> </span><span class="nt">shortcut</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">slr</span> +<span class="w"> </span><span class="nt">base_url</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">http://localhost:8983</span> +<span class="w"> </span><span class="nt">collection</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my-collection</span> +<span class="w"> </span><span class="nt">sort</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">asc</span> +<span class="w"> </span><span class="nt">enable_http</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">true</span> +</pre></div> +</div> +</section> +</section> +</section> + + + <div class="clearer"></div> + </div> + </div> + </div> + <span id="sidebar-top"></span> + <div class="sphinxsidebar" role="navigation" aria-label="Main"> + <div class="sphinxsidebarwrapper"> + + + <p class="logo"><a href="../../../index.html"> + <img class="logo" src="../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/> + </a></p> + + +<h3><a href="../../../index.html">Table of Contents</a></h3> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="../../../user/index.html">User information</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../own-instance.html">Why use a private instance?</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../admin/index.html">Administrator documentation</a></li> +<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Developer documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="../../quickstart.html">Development Quickstart</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../rtm_asdf.html">Runtime Management</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../contribution_guide.html">How to contribute</a></li> +<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Engine Implementations</a><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="../enginelib.html">Engine Library</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engines.html">SearXNG’s engines loader</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engine_overview.html">Engine Overview</a></li> +<li class="toctree-l3 current"><a class="reference internal" href="../index.html#engine-types">Engine Types</a><ul class="current"> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-engines">Online Engines</a></li> +<li class="toctree-l4 current"><a class="reference internal" href="../index.html#offline-engines">Offline Engines</a><ul class="current"> +<li class="toctree-l5"><a class="reference internal" href="../offline_concept.html">Offline Concept</a></li> +<li class="toctree-l5"><a class="reference internal" href="../demo/demo_offline.html">Demo Offline Engine</a></li> +<li class="toctree-l5"><a class="reference internal" href="command-line-engines.html">Command Line Engines</a></li> +<li class="toctree-l5"><a class="reference internal" href="nosql-engines.html">NoSQL databases</a></li> +<li class="toctree-l5 current"><a class="current reference internal" href="#">Local Search APIs</a></li> +<li class="toctree-l5"><a class="reference internal" href="sql-engines.html">SQL Engines</a></li> +</ul> +</li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-url-search">Online URL Search</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-currency">Online Currency</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-dictionary">Online Dictionary</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="../../search_api.html">Search API</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../plugins.html">Plugins</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../translation.html">Translation</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../lxcdev.html">Developing in Linux Containers</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../makefile.html">Makefile & <code class="docutils literal notranslate"><span class="pre">./manage</span></code></a></li> +<li class="toctree-l2"><a class="reference internal" href="../../reST.html">reST primer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../../../utils/index.html">DevOps tooling box</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../src/index.html">Source-Code</a></li> +</ul> + + <h3>Project Links</h3> + <ul> + <li><a href="https://github.com/searxng/searxng/tree/master">Source</a> + + <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a> + + <li><a href="https://searx.space">Public instances</a> + + <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a> + </ul><h3>Navigation</h3> +<ul> + <li><a href="../../../index.html">Overview</a> + <ul> + <li><a href="../../index.html">Developer documentation</a> + <ul> + <li><a href="../index.html">Engine Implementations</a> + <ul> + <li>Previous: <a href="nosql-engines.html" title="previous chapter">NoSQL databases</a> + <li>Next: <a href="sql-engines.html" title="next chapter">SQL Engines</a></ul> + </li></ul> + </li> + </ul> + </li> +</ul> +<search 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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> + <input type="submit" value="Go" /> + </form> + </div> +</search> +<script>document.getElementById('searchbox').style.display = "block"</script> + <div role="note" aria-label="source link"> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../../_sources/dev/engines/offline/search-indexer-engines.rst.txt" + rel="nofollow">Show Source</a></li> + </ul> + </div> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="footer" role="contentinfo"> + © Copyright SearXNG team. + </div> + </body> +</html>
\ No newline at end of file diff --git a/dev/engines/offline/sql-engines.html b/dev/engines/offline/sql-engines.html new file mode 100644 index 000000000..240c930a9 --- /dev/null +++ b/dev/engines/offline/sql-engines.html @@ -0,0 +1,493 @@ +<!DOCTYPE html> + +<html lang="en" data-content_root="../../../"> + <head> + <meta charset="utf-8" /> + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>SQL Engines — SearXNG Documentation (2025.1.6+6dab7fe78)</title> + <link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=4f649999" /> + <link rel="stylesheet" type="text/css" href="../../../_static/searxng.css?v=52e4ff28" /> + <script src="../../../_static/documentation_options.js?v=ef740023"></script> + <script src="../../../_static/doctools.js?v=9a2dae69"></script> + <script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script> + <script data-project="searxng" data-version="2025.1.6+6dab7fe78" src="../../../_static/describe_version.js?v=fa7f30d0"></script> + <link rel="index" title="Index" href="../../../genindex.html" /> + <link rel="search" title="Search" href="../../../search.html" /> + <link rel="next" title="Tineye" href="../online_url_search/tineye.html" /> + <link rel="prev" title="Local Search APIs" href="search-indexer-engines.html" /> + </head><body> + <div class="related" role="navigation" aria-label="Related"> + <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> + <li class="right" > + <a href="../online_url_search/tineye.html" title="Tineye" + accesskey="N">next</a> |</li> + <li class="right" > + <a href="search-indexer-engines.html" title="Local Search APIs" + accesskey="P">previous</a> |</li> + <li class="nav-item nav-item-0"><a href="../../../index.html">SearXNG Documentation (2025.1.6+6dab7fe78)</a> »</li> + <li class="nav-item nav-item-1"><a href="../../index.html" >Developer documentation</a> »</li> + <li class="nav-item nav-item-2"><a href="../index.html" accesskey="U">Engine Implementations</a> »</li> + <li class="nav-item nav-item-this"><a href="">SQL Engines</a></li> + </ul> + </div> + + <div class="document"> + <div class="documentwrapper"> + <div class="bodywrapper"> + <div class="body" role="main"> + + <section id="sql-engines"> +<span id="id1"></span><h1>SQL Engines<a class="headerlink" href="#sql-engines" title="Link to this heading">¶</a></h1> +<aside class="sidebar"> +<p class="sidebar-title">further read</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://www.sqlite.org/index.html">SQLite</a></p></li> +<li><p><a class="reference external" href="https://www.postgresql.org">PostgreSQL</a></p></li> +<li><p><a class="reference external" href="https://www.mysql.com">MySQL</a></p></li> +</ul> +</aside> +<nav class="contents local" id="contents"> +<ul class="simple"> +<li><p><a class="reference internal" href="#extra-dependencies" id="id11">Extra Dependencies</a></p></li> +<li><p><a class="reference internal" href="#configure-the-engines" id="id12">Configure the engines</a></p> +<ul> +<li><p><a class="reference internal" href="#engine-sqlite" id="id13">SQLite</a></p></li> +<li><p><a class="reference internal" href="#engine-postgresql" id="id14">PostgreSQL</a></p></li> +<li><p><a class="reference internal" href="#engine-mysql-server" id="id15">MySQL</a></p></li> +<li><p><a class="reference internal" href="#mariadb" id="id16">MariaDB</a></p></li> +</ul> +</li> +</ul> +</nav> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<p>Initial sponsored by <a class="reference external" href="https://nlnet.nl/discovery">Search and Discovery Fund</a> of <a class="reference external" href="https://nlnet.nl/">NLnet Foundation</a>.</p> +</aside> +<p>With the <em>SQL engines</em> you can bind SQL databases into SearXNG. The following +Relational Database Management System (RDBMS) are supported:</p> +<ul class="simple"> +<li><p><a class="reference internal" href="#engine-sqlite"><span class="std std-ref">SQLite</span></a></p></li> +<li><p><a class="reference internal" href="#engine-postgresql"><span class="std std-ref">PostgreSQL</span></a></p></li> +<li><p><a class="reference internal" href="#engine-mysql-server"><span class="std std-ref">MySQL</span></a> & <a class="reference internal" href="#engine-mariadb-server"><span class="std std-ref">MariaDB</span></a></p></li> +</ul> +<p>All of the engines above are just commented out in the <a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/settings.yml">settings.yml</a>, as you have to set the required attributes for the +engines, e.g. <code class="docutils literal notranslate"><span class="pre">database:</span></code> …</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nv">sqlite|postgresql|mysql_server</span><span class="p p-Indicator">}</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span> +<span class="w"> </span><span class="nt">result_template</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">{</span><span class="nv">template_name</span><span class="p p-Indicator">}</span> +<span class="w"> </span><span class="nt">query_str</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">...</span> +</pre></div> +</div> +<p>By default, the engines use the <code class="docutils literal notranslate"><span class="pre">key-value</span></code> template for displaying results / +see <a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/templates/simple/result_templates/key-value.html">simple</a> +theme. If you are not satisfied with the original result layout, you can use +your own template, set <code class="docutils literal notranslate"><span class="pre">result_template</span></code> attribute to <code class="docutils literal notranslate"><span class="pre">{template_name}</span></code> and +place the templates at:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">searx</span><span class="o">/</span><span class="n">templates</span><span class="o">/</span><span class="p">{</span><span class="n">theme_name</span><span class="p">}</span><span class="o">/</span><span class="n">result_templates</span><span class="o">/</span><span class="p">{</span><span class="n">template_name</span><span class="p">}</span> +</pre></div> +</div> +<p>If you do not wish to expose these engines on a public instance, you can still +add them and limit the access by setting <code class="docutils literal notranslate"><span class="pre">tokens</span></code> as described in section +<a class="reference internal" href="../../../admin/settings/settings_engine.html#private-engines"><span class="std std-ref">Private Engines (tokens)</span></a>.</p> +<section id="extra-dependencies"> +<h2><a class="toc-backref" href="#id11" role="doc-backlink">Extra Dependencies</a><a class="headerlink" href="#extra-dependencies" title="Link to this heading">¶</a></h2> +<p>For using <a class="reference internal" href="#engine-postgresql"><span class="std std-ref">PostgreSQL</span></a> or <a class="reference internal" href="#engine-mysql-server"><span class="std std-ref">MySQL</span></a> you need to +install additional packages in Python’s Virtual Environment of your SearXNG +instance. To switch into the environment (<a class="reference internal" href="../../../admin/installation-searxng.html#searxng-src"><span class="std std-ref">Install SearXNG & dependencies</span></a>) you can use +<a class="reference internal" href="../../../utils/searxng.sh.html#searxng-sh"><span class="std std-ref">utils/searxng.sh</span></a>:</p> +<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ sudo utils/searxng.sh instance cmd bash +(searxng-pyenv)$ pip install ... +</pre></div> +</div> +</section> +<section id="configure-the-engines"> +<h2><a class="toc-backref" href="#id12" role="doc-backlink">Configure the engines</a><a class="headerlink" href="#configure-the-engines" title="Link to this heading">¶</a></h2> +<p>The configuration of the new database engines are similar. You must put a valid +SQL-SELECT query in <code class="docutils literal notranslate"><span class="pre">query_str</span></code>. At the moment you can only bind at most one +parameter in your query. By setting the attribute <code class="docutils literal notranslate"><span class="pre">limit</span></code> you can define how +many results you want from the SQL server. Basically, it is the same as the +<code class="docutils literal notranslate"><span class="pre">LIMIT</span></code> keyword in SQL.</p> +<p>Please, do not include <code class="docutils literal notranslate"><span class="pre">LIMIT</span></code> or <code class="docutils literal notranslate"><span class="pre">OFFSET</span></code> in your SQL query as the engines +rely on these keywords during paging. If you want to configure the number of +returned results use the option <code class="docutils literal notranslate"><span class="pre">limit</span></code>.</p> +<section id="engine-sqlite"> +<span id="id2"></span><h3><a class="toc-backref" href="#id13" role="doc-backlink">SQLite</a><a class="headerlink" href="#engine-sqlite" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/sqlite.py">sqlite.py</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.sqlite">SQLite is a small, fast and reliable SQL database engine. It does not require +any extra dependency.</p> +<section id="example"> +<h4>Example<a class="headerlink" href="#example" title="Link to this heading">¶</a></h4> +<p>To demonstrate the power of database engines, here is a more complex example +which reads from a <a class="reference external" href="https://mediathekview.de/">MediathekView</a> (DE) movie database. For this example of the +SQLite engine download the database:</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://liste.mediathekview.de/filmliste-v2.db.bz2">https://liste.mediathekview.de/filmliste-v2.db.bz2</a></p></li> +</ul> +<p>and unpack into <code class="docutils literal notranslate"><span class="pre">searx/data/filmliste-v2.db</span></code>. To search the database use e.g +Query to test: <code class="docutils literal notranslate"><span class="pre">!mediathekview</span> <span class="pre">concert</span></code></p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mediathekview</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">sqlite</span> +<span class="w"> </span><span class="nt">disabled</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">False</span> +<span class="w"> </span><span class="nt">categories</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">general</span> +<span class="w"> </span><span class="nt">result_template</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">default.html</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">searx/data/filmliste-v2.db</span> +<span class="w"> </span><span class="nt">query_str</span><span class="p">:</span><span class="w"> </span><span class="p p-Indicator">>-</span> +<span class="w"> </span><span class="no">SELECT title || ' (' || time(duration, 'unixepoch') || ')' AS title,</span> +<span class="w"> </span><span class="no">COALESCE( NULLIF(url_video_hd,''), NULLIF(url_video_sd,''), url_video) AS url,</span> +<span class="w"> </span><span class="no">description AS content</span> +<span class="w"> </span><span class="no">FROM film</span> +<span class="w"> </span><span class="no">WHERE title LIKE :wildcard OR description LIKE :wildcard</span> +<span class="w"> </span><span class="no">ORDER BY duration DESC</span> +</pre></div> +</div> +</section> +<section id="implementations"> +<h4>Implementations<a class="headerlink" href="#implementations" title="Link to this heading">¶</a></h4> +</section> +<dl class="py function"> +<dt class="sig sig-object py" id="searx.engines.sqlite.sqlite_cursor"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.sqlite.</span></span><span class="sig-name descname"><span class="pre">sqlite_cursor</span></span><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="../../../_modules/searx/engines/sqlite.html#sqlite_cursor"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#searx.engines.sqlite.sqlite_cursor" title="Link to this definition">¶</a></dt> +<dd><p>Implements a <a class="reference external" href="https://docs.python.org/3/library/contextlib.html#contextlib.contextmanager" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context</span> <span class="pre">Manager</span></code></a> for a +<a class="reference external" href="https://docs.python.org/3/library/sqlite3.html#sqlite3.Cursor" title="(in Python v3.13)"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sqlite3.Cursor</span></code></a>.</p> +<p>Open database in read only mode: if the database doesn’t exist. The default +mode creates an empty file on the file system. See:</p> +<ul class="simple"> +<li><p><a class="reference external" href="https://docs.python.org/3/library/sqlite3.html#sqlite3.connect">https://docs.python.org/3/library/sqlite3.html#sqlite3.connect</a></p></li> +<li><p><a class="reference external" href="https://www.sqlite.org/uri.html">https://www.sqlite.org/uri.html</a></p></li> +</ul> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.sqlite.database"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.sqlite.</span></span><span class="sig-name descname"><span class="pre">database</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.sqlite.database" title="Link to this definition">¶</a></dt> +<dd><p>Filename of the SQLite DB.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.sqlite.query_str"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.sqlite.</span></span><span class="sig-name descname"><span class="pre">query_str</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.sqlite.query_str" title="Link to this definition">¶</a></dt> +<dd><p>SQL query that returns the result items.</p> +</dd></dl> + +</section> +<section id="engine-postgresql"> +<span id="id3"></span><h3><a class="toc-backref" href="#id14" role="doc-backlink">PostgreSQL</a><a class="headerlink" href="#engine-postgresql" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/postgresql.py">postgresql.py</a></p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span></code> <a class="reference external" href="psycopg2">psycopg2-binary</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.postgresql">PostgreSQL is a powerful and robust open source database. Before configuring +the PostgreSQL engine, you must install the dependency <code class="docutils literal notranslate"><span class="pre">psychopg2</span></code>.</p> +<section id="id4"> +<h4>Example<a class="headerlink" href="#id4" title="Link to this heading">¶</a></h4> +<p>Below is an example configuration:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">postgresql</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">searxng</span> +<span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">password</span> +<span class="w"> </span><span class="nt">query_str</span><span class="p">:</span><span class="w"> </span><span class="s">'SELECT</span><span class="nv"> </span><span class="s">*</span><span class="nv"> </span><span class="s">from</span><span class="nv"> </span><span class="s">my_table</span><span class="nv"> </span><span class="s">WHERE</span><span class="nv"> </span><span class="s">my_column</span><span class="nv"> </span><span class="s">=</span><span class="nv"> </span><span class="s">%(query)s'</span> +</pre></div> +</div> +</section> +<section id="id5"> +<h4>Implementations<a class="headerlink" href="#id5" title="Link to this heading">¶</a></h4> +</section> +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.database"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">database</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.postgresql.database" title="Link to this definition">¶</a></dt> +<dd><p>Name of the database.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.host"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">host</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'127.0.0.1'</span></em><a class="headerlink" href="#searx.engines.postgresql.host" title="Link to this definition">¶</a></dt> +<dd><p>Hostname of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.password"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">password</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.postgresql.password" title="Link to this definition">¶</a></dt> +<dd><p>Password for the DB connection.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.port"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">port</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'5432'</span></em><a class="headerlink" href="#searx.engines.postgresql.port" title="Link to this definition">¶</a></dt> +<dd><p>Port of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.query_str"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">query_str</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.postgresql.query_str" title="Link to this definition">¶</a></dt> +<dd><p>SQL query that returns the result items.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.postgresql.username"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.postgresql.</span></span><span class="sig-name descname"><span class="pre">username</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.postgresql.username" title="Link to this definition">¶</a></dt> +<dd><p>Username for the DB connection.</p> +</dd></dl> + +</section> +<section id="engine-mysql-server"> +<span id="id6"></span><h3><a class="toc-backref" href="#id15" role="doc-backlink">MySQL</a><a class="headerlink" href="#engine-mysql-server" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/mysql_server.py">mysql_server.py</a></p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span></code> <a class="extlink-pypi reference external" href="https://pypi.org/project/mysql-connector-python">mysql-connector-python</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.mysql_server">MySQL is said to be the most popular open source database. Before enabling +MySQL engine, you must install the package <code class="docutils literal notranslate"><span class="pre">mysql-connector-python</span></code>.</p> +<p>The authentication plugin is configurable by setting <code class="docutils literal notranslate"><span class="pre">auth_plugin</span></code> in the +attributes. By default it is set to <code class="docutils literal notranslate"><span class="pre">caching_sha2_password</span></code>.</p> +<section id="id7"> +<h4>Example<a class="headerlink" href="#id7" title="Link to this heading">¶</a></h4> +<p>This is an example configuration for querying a MySQL server:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mysql_server</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">searxng</span> +<span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">password</span> +<span class="w"> </span><span class="nt">limit</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">5</span> +<span class="w"> </span><span class="nt">query_str</span><span class="p">:</span><span class="w"> </span><span class="s">'SELECT</span><span class="nv"> </span><span class="s">*</span><span class="nv"> </span><span class="s">from</span><span class="nv"> </span><span class="s">my_table</span><span class="nv"> </span><span class="s">WHERE</span><span class="nv"> </span><span class="s">my_column=%(query)s'</span> +</pre></div> +</div> +</section> +<section id="id8"> +<h4>Implementations<a class="headerlink" href="#id8" title="Link to this heading">¶</a></h4> +</section> +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.database"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">database</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mysql_server.database" title="Link to this definition">¶</a></dt> +<dd><p>Name of the database.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.host"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">host</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'127.0.0.1'</span></em><a class="headerlink" href="#searx.engines.mysql_server.host" title="Link to this definition">¶</a></dt> +<dd><p>Hostname of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.password"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">password</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mysql_server.password" title="Link to this definition">¶</a></dt> +<dd><p>Password for the DB connection.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.port"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">port</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">3306</span></em><a class="headerlink" href="#searx.engines.mysql_server.port" title="Link to this definition">¶</a></dt> +<dd><p>Port of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.query_str"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">query_str</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mysql_server.query_str" title="Link to this definition">¶</a></dt> +<dd><p>SQL query that returns the result items.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mysql_server.username"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mysql_server.</span></span><span class="sig-name descname"><span class="pre">username</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mysql_server.username" title="Link to this definition">¶</a></dt> +<dd><p>Username for the DB connection.</p> +</dd></dl> + +</section> +<section id="mariadb"> +<span id="engine-mariadb-server"></span><h3><a class="toc-backref" href="#id16" role="doc-backlink">MariaDB</a><a class="headerlink" href="#mariadb" title="Link to this heading">¶</a></h3> +<aside class="sidebar"> +<p class="sidebar-title">info</p> +<ul class="simple"> +<li><p><a class="extlink-origin reference external" href="https://github.com/searxng/searxng/blob/master/searx/engines/mariadb_server.py">mariadb_server.py</a></p></li> +<li><p><code class="docutils literal notranslate"><span class="pre">pip</span> <span class="pre">install</span></code> <a class="extlink-pypi reference external" href="https://pypi.org/project/mariadb">mariadb</a></p></li> +</ul> +</aside> +<p id="module-searx.engines.mariadb_server">MariaDB is a community driven fork of MySQL. Before enabling MariaDB engine, +you must the install the pip package <code class="docutils literal notranslate"><span class="pre">mariadb</span></code> along with the necessary +prerequities.</p> +<p><a class="reference external" href="https://mariadb.com/docs/server/connect/programming-languages/c/install/">See the following documentation for more details</a></p> +<section id="id9"> +<h4>Example<a class="headerlink" href="#id9" title="Link to this heading">¶</a></h4> +<p>This is an example configuration for querying a MariaDB server:</p> +<div class="highlight-yaml notranslate"><div class="highlight"><pre><span></span><span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">engine</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">mariadb_server</span> +<span class="w"> </span><span class="nt">database</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">my_database</span> +<span class="w"> </span><span class="nt">username</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">searxng</span> +<span class="w"> </span><span class="nt">password</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">password</span> +<span class="w"> </span><span class="nt">limit</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">5</span> +<span class="w"> </span><span class="nt">query_str</span><span class="p">:</span><span class="w"> </span><span class="s">'SELECT</span><span class="nv"> </span><span class="s">*</span><span class="nv"> </span><span class="s">from</span><span class="nv"> </span><span class="s">my_table</span><span class="nv"> </span><span class="s">WHERE</span><span class="nv"> </span><span class="s">my_column=%(query)s'</span> +</pre></div> +</div> +</section> +<section id="id10"> +<h4>Implementations<a class="headerlink" href="#id10" title="Link to this heading">¶</a></h4> +</section> +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.database"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">database</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mariadb_server.database" title="Link to this definition">¶</a></dt> +<dd><p>Name of the database.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.host"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">host</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">'127.0.0.1'</span></em><a class="headerlink" href="#searx.engines.mariadb_server.host" title="Link to this definition">¶</a></dt> +<dd><p>Hostname of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.password"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">password</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mariadb_server.password" title="Link to this definition">¶</a></dt> +<dd><p>Password for the DB connection.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.port"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">port</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">3306</span></em><a class="headerlink" href="#searx.engines.mariadb_server.port" title="Link to this definition">¶</a></dt> +<dd><p>Port of the DB connector</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.query_str"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">query_str</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mariadb_server.query_str" title="Link to this definition">¶</a></dt> +<dd><p>SQL query that returns the result items.</p> +</dd></dl> + +<dl class="py data"> +<dt class="sig sig-object py" id="searx.engines.mariadb_server.username"> +<span class="sig-prename descclassname"><span class="pre">searx.engines.mariadb_server.</span></span><span class="sig-name descname"><span class="pre">username</span></span><em class="property"><span class="w"> </span><span class="p"><span class="pre">=</span></span><span class="w"> </span><span class="pre">''</span></em><a class="headerlink" href="#searx.engines.mariadb_server.username" title="Link to this definition">¶</a></dt> +<dd><p>Username for the DB connection.</p> +</dd></dl> + +</section> +</section> +</section> + + + <div class="clearer"></div> + </div> + </div> + </div> + <span id="sidebar-top"></span> + <div class="sphinxsidebar" role="navigation" aria-label="Main"> + <div class="sphinxsidebarwrapper"> + + + <p class="logo"><a href="../../../index.html"> + <img class="logo" src="../../../_static/searxng-wordmark.svg" alt="Logo of SearXNG"/> + </a></p> + + +<h3><a href="../../../index.html">Table of Contents</a></h3> +<ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="../../../user/index.html">User information</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../own-instance.html">Why use a private instance?</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../admin/index.html">Administrator documentation</a></li> +<li class="toctree-l1 current"><a class="reference internal" href="../../index.html">Developer documentation</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="../../quickstart.html">Development Quickstart</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../rtm_asdf.html">Runtime Management</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../contribution_guide.html">How to contribute</a></li> +<li class="toctree-l2 current"><a class="reference internal" href="../index.html">Engine Implementations</a><ul class="current"> +<li class="toctree-l3"><a class="reference internal" href="../enginelib.html">Engine Library</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engines.html">SearXNG’s engines loader</a></li> +<li class="toctree-l3"><a class="reference internal" href="../engine_overview.html">Engine Overview</a></li> +<li class="toctree-l3 current"><a class="reference internal" href="../index.html#engine-types">Engine Types</a><ul class="current"> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-engines">Online Engines</a></li> +<li class="toctree-l4 current"><a class="reference internal" href="../index.html#offline-engines">Offline Engines</a><ul class="current"> +<li class="toctree-l5"><a class="reference internal" href="../offline_concept.html">Offline Concept</a></li> +<li class="toctree-l5"><a class="reference internal" href="../demo/demo_offline.html">Demo Offline Engine</a></li> +<li class="toctree-l5"><a class="reference internal" href="command-line-engines.html">Command Line Engines</a></li> +<li class="toctree-l5"><a class="reference internal" href="nosql-engines.html">NoSQL databases</a></li> +<li class="toctree-l5"><a class="reference internal" href="search-indexer-engines.html">Local Search APIs</a></li> +<li class="toctree-l5 current"><a class="current reference internal" href="#">SQL Engines</a></li> +</ul> +</li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-url-search">Online URL Search</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-currency">Online Currency</a></li> +<li class="toctree-l4"><a class="reference internal" href="../index.html#online-dictionary">Online Dictionary</a></li> +</ul> +</li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="../../search_api.html">Search API</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../plugins.html">Plugins</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../translation.html">Translation</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../lxcdev.html">Developing in Linux Containers</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../makefile.html">Makefile & <code class="docutils literal notranslate"><span class="pre">./manage</span></code></a></li> +<li class="toctree-l2"><a class="reference internal" href="../../reST.html">reST primer</a></li> +<li class="toctree-l2"><a class="reference internal" href="../../searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../../../utils/index.html">DevOps tooling box</a></li> +<li class="toctree-l1"><a class="reference internal" href="../../../src/index.html">Source-Code</a></li> +</ul> + + <h3>Project Links</h3> + <ul> + <li><a href="https://github.com/searxng/searxng/tree/master">Source</a> + + <li><a href="https://github.com/searxng/searxng/wiki">Wiki</a> + + <li><a href="https://searx.space">Public instances</a> + + <li><a href="https://github.com/searxng/searxng/issues">Issue Tracker</a> + </ul><h3>Navigation</h3> +<ul> + <li><a href="../../../index.html">Overview</a> + <ul> + <li><a href="../../index.html">Developer documentation</a> + <ul> + <li><a href="../index.html">Engine Implementations</a> + <ul> + <li>Previous: <a href="search-indexer-engines.html" title="previous chapter">Local Search APIs</a> + <li>Next: <a href="../online_url_search/tineye.html" title="next chapter">Tineye</a></ul> + </li></ul> + </li> + </ul> + </li> +</ul> +<search 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" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/> + <input type="submit" value="Go" /> + </form> + </div> +</search> +<script>document.getElementById('searchbox').style.display = "block"</script> + <div role="note" aria-label="source link"> + <h3>This Page</h3> + <ul class="this-page-menu"> + <li><a href="../../../_sources/dev/engines/offline/sql-engines.rst.txt" + rel="nofollow">Show Source</a></li> + </ul> + </div> + </div> + </div> + <div class="clearer"></div> + </div> + <div class="footer" role="contentinfo"> + © Copyright SearXNG team. + </div> + </body> +</html>
\ No newline at end of file |