Files
2026-05-07 14:21:13 +00:00

842 lines
71 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!doctype html>
<html class="no-js" lang="en" data-content_root="../../">
<head><meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="color-scheme" content="light dark"><link rel="index" title="Index" href="../../genindex.html"><link rel="search" title="Search" href="../../search.html">
<link rel="prefetch" href="../../_static/searxng-wordmark.svg" as="image">
<!-- Generated with Sphinx 9.1.0 and Furo 2025.12.19 -->
<title>searx.enginelib - SearXNG Documentation (2026.5.7+ef6290c8c)</title>
<link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=d111a655" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=7bdb33bb" />
<link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=8dab3a3b" />
<link rel="stylesheet" type="text/css" href="../../_static/searxng.css?v=4b1b1f10" />
<style>
body {
--color-code-background: #f2f2f2;
--color-code-foreground: #1e1e1e;
}
@media not print {
body[data-theme="dark"] {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
@media (prefers-color-scheme: dark) {
body:not([data-theme="light"]) {
--color-code-background: #202020;
--color-code-foreground: #d0d0d0;
}
}
}
</style></head>
<body>
<script>
document.body.dataset.theme = localStorage.getItem("theme") || "auto";
</script>
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol id="svg-toc" viewBox="0 0 24 24">
<title>Contents</title>
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
<path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
</svg>
</symbol>
<symbol id="svg-menu" viewBox="0 0 24 24">
<title>Menu</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
<line x1="3" y1="12" x2="21" y2="12"></line>
<line x1="3" y1="6" x2="21" y2="6"></line>
<line x1="3" y1="18" x2="21" y2="18"></line>
</svg>
</symbol>
<symbol id="svg-arrow-right" viewBox="0 0 24 24">
<title>Expand</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
<polyline points="9 18 15 12 9 6"></polyline>
</svg>
</symbol>
<symbol id="svg-sun" viewBox="0 0 24 24">
<title>Light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
<circle cx="12" cy="12" r="5"></circle>
<line x1="12" y1="1" x2="12" y2="3"></line>
<line x1="12" y1="21" x2="12" y2="23"></line>
<line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
<line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
<line x1="1" y1="12" x2="3" y2="12"></line>
<line x1="21" y1="12" x2="23" y2="12"></line>
<line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
<line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
</svg>
</symbol>
<symbol id="svg-moon" viewBox="0 0 24 24">
<title>Dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
</svg>
</symbol>
<symbol id="svg-sun-with-moon" viewBox="0 0 24 24">
<title>Auto light/dark, in light mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
class="icon-custom-derived-from-feather-sun-and-tabler-moon">
<path style="opacity: 50%" d="M 5.411 14.504 C 5.471 14.504 5.532 14.504 5.591 14.504 C 3.639 16.319 4.383 19.569 6.931 20.352 C 7.693 20.586 8.512 20.551 9.25 20.252 C 8.023 23.207 4.056 23.725 2.11 21.184 C 0.166 18.642 1.702 14.949 4.874 14.536 C 5.051 14.512 5.231 14.5 5.411 14.5 L 5.411 14.504 Z"/>
<line x1="14.5" y1="3.25" x2="14.5" y2="1.25"/>
<line x1="14.5" y1="15.85" x2="14.5" y2="17.85"/>
<line x1="10.044" y1="5.094" x2="8.63" y2="3.68"/>
<line x1="19" y1="14.05" x2="20.414" y2="15.464"/>
<line x1="8.2" y1="9.55" x2="6.2" y2="9.55"/>
<line x1="20.8" y1="9.55" x2="22.8" y2="9.55"/>
<line x1="10.044" y1="14.006" x2="8.63" y2="15.42"/>
<line x1="19" y1="5.05" x2="20.414" y2="3.636"/>
<circle cx="14.5" cy="9.55" r="3.6"/>
</svg>
</symbol>
<symbol id="svg-moon-with-sun" viewBox="0 0 24 24">
<title>Auto light/dark, in dark mode</title>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round"
class="icon-custom-derived-from-feather-sun-and-tabler-moon">
<path d="M 8.282 7.007 C 8.385 7.007 8.494 7.007 8.595 7.007 C 5.18 10.184 6.481 15.869 10.942 17.24 C 12.275 17.648 13.706 17.589 15 17.066 C 12.851 22.236 5.91 23.143 2.505 18.696 C -0.897 14.249 1.791 7.786 7.342 7.063 C 7.652 7.021 7.965 7 8.282 7 L 8.282 7.007 Z"/>
<line style="opacity: 50%" x1="18" y1="3.705" x2="18" y2="2.5"/>
<line style="opacity: 50%" x1="18" y1="11.295" x2="18" y2="12.5"/>
<line style="opacity: 50%" x1="15.316" y1="4.816" x2="14.464" y2="3.964"/>
<line style="opacity: 50%" x1="20.711" y1="10.212" x2="21.563" y2="11.063"/>
<line style="opacity: 50%" x1="14.205" y1="7.5" x2="13.001" y2="7.5"/>
<line style="opacity: 50%" x1="21.795" y1="7.5" x2="23" y2="7.5"/>
<line style="opacity: 50%" x1="15.316" y1="10.184" x2="14.464" y2="11.036"/>
<line style="opacity: 50%" x1="20.711" y1="4.789" x2="21.563" y2="3.937"/>
<circle style="opacity: 50%" cx="18" cy="7.5" r="2.169"/>
</svg>
</symbol>
<symbol id="svg-pencil" viewBox="0 0 24 24">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-pencil-code">
<path d="M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4" />
<path d="M13.5 6.5l4 4" />
<path d="M20 21l2 -2l-2 -2" />
<path d="M17 17l-2 2l2 2" />
</svg>
</symbol>
<symbol id="svg-eye" viewBox="0 0 24 24">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="1" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-eye-code">
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0" />
<path
d="M11.11 17.958c-3.209 -.307 -5.91 -2.293 -8.11 -5.958c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6c-.21 .352 -.427 .688 -.647 1.008" />
<path d="M20 21l2 -2l-2 -2" />
<path d="M17 17l-2 2l2 2" />
</svg>
</symbol>
</svg>
<input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation" aria-label="Toggle site navigation sidebar">
<input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc" aria-label="Toggle table of contents sidebar">
<label class="overlay sidebar-overlay" for="__navigation"></label>
<label class="overlay toc-overlay" for="__toc"></label>
<a class="skip-to-content muted-link" href="#furo-main-content">Skip to content</a>
<div class="page">
<header class="mobile-header">
<div class="header-left">
<label class="nav-overlay-icon" for="__navigation">
<span class="icon"><svg><use href="#svg-menu"></use></svg></span>
</label>
</div>
<div class="header-center">
<a href="../../index.html"><div class="brand">SearXNG Documentation (2026.5.7+ef6290c8c)</div></a>
</div>
<div class="header-right">
<div class="theme-toggle-container theme-toggle-header">
<button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-header-icon no-toc" for="__toc">
<span class="icon"><svg><use href="#svg-toc"></use></svg></span>
</label>
</div>
</header>
<aside class="sidebar-drawer">
<div class="sidebar-container">
<div class="sidebar-sticky"><div class="sidebar-scroll"><a class="sidebar-brand" href="../../index.html">
<div class="sidebar-logo-container">
<img class="sidebar-logo" src="../../_static/searxng-wordmark.svg" alt="Logo"/>
</div>
<span class="sidebar-brand-text">SearXNG Documentation (2026.5.7+ef6290c8c)</span>
</a><form class="sidebar-search-container" method="get" action="../../search.html" role="search">
<input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
<input type="hidden" name="check_keywords" value="yes">
<input type="hidden" name="area" value="default">
</form>
<div id="searchbox"></div><div class="sidebar-tree">
<ul>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../user/index.html">User information</a><input aria-label="Toggle navigation of User information" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../user/search-syntax.html">Search syntax</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../user/configured_engines.html">Configured Engines</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../user/about.html">About SearXNG</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../own-instance.html">Why use a private instance?</a></li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../admin/index.html">Administrator documentation</a><input aria-label="Toggle navigation of Administrator documentation" class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../admin/settings/index.html">Settings</a><input aria-label="Toggle navigation of Settings" class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings.html"><code class="docutils literal notranslate"><span class="pre">settings.yml</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_engines.html"><code class="docutils literal notranslate"><span class="pre">engines:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_brand.html"><code class="docutils literal notranslate"><span class="pre">brand:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_general.html"><code class="docutils literal notranslate"><span class="pre">general:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_search.html"><code class="docutils literal notranslate"><span class="pre">search:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_server.html"><code class="docutils literal notranslate"><span class="pre">server:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_ui.html"><code class="docutils literal notranslate"><span class="pre">ui:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_redis.html"><code class="docutils literal notranslate"><span class="pre">redis:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_valkey.html"><code class="docutils literal notranslate"><span class="pre">valkey:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_outgoing.html"><code class="docutils literal notranslate"><span class="pre">outgoing:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_categories_as_tabs.html"><code class="docutils literal notranslate"><span class="pre">categories_as_tabs:</span></code></a></li>
<li class="toctree-l3"><a class="reference internal" href="../../admin/settings/settings_plugins.html"><code class="docutils literal notranslate"><span class="pre">plugins:</span></code></a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation.html">Installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-docker.html">Installation container</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-scripts.html">Installation Script</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-searxng.html">Step by step installation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-granian.html">Granian</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-uwsgi.html">uWSGI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-nginx.html">NGINX</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/installation-apache.html">Apache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/update-searxng.html">SearXNG maintenance</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/answer-captcha.html">Answer CAPTCHA from servers IP</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/searx.favicons.html">Favicons</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/searx.limiter.html">Limiter</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/api.html">Administration API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/architecture.html">Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/plugins.html">List of plugins</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../admin/buildhosts.html">Buildhosts</a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../dev/index.html">Developer documentation</a><input aria-label="Toggle navigation of Developer documentation" class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" role="switch" type="checkbox"/><label for="toctree-checkbox-4"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../dev/quickstart.html">Development Quickstart</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/commits.html">Git Commits &amp; Change Management</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/contribution_guide.html">How to contribute</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/extended_types.html">Extended Types</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../dev/engines/index.html">Engine Implementations</a><input aria-label="Toggle navigation of Engine Implementations" class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" role="switch" type="checkbox"/><label for="toctree-checkbox-5"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/enginelib.html">Engine Library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/engines.html">SearXNGs engines loader</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/engine_overview.html">Engine Overview</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/demo/demo_online.html">Demo Online Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/xpath.html">XPath Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/mediawiki.html">MediaWiki Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/json_engine.html">JSON Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/adobe_stock.html">Adobe Stock</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/alpinelinux.html">Alpine Linux Packages</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/annas_archive.html">Annas Archive</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/aol.html">AOL</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/archlinux.html">Arch Linux</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/arxiv.html">arXiv</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/astrophysics_data_system.html">Astrophysics Data System (ADS)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/azure.html">Azure Resources</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/bing.html">Bing Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/bpb.html">Bpb</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/brave.html">Brave Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/bt4g.html">BT4G</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/chinaso.html">ChinaSo</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/core.html">CORE</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/crossref.html">Crossref</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/dailymotion.html">Dailymotion</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/discourse.html">Discourse Forums</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/duckduckgo.html">DuckDuckGo Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/geizhals.html">Geizhals</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/gitea.html">Gitea</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/github_code.html">Github Code</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/gitlab.html">GitLab</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/google.html">Google Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/huggingface.html">Hugging Face</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/karmasearch.html">Karmasearch</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/lemmy.html">Lemmy</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/loc.html">Library of Congress</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/marginalia.html">Marginalia Search</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/mastodon.html">Mastodon</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/moviepilot.html">Moviepilot</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/mrs.html">Matrix Rooms Search (MRS)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/mwmbl.html">Mwmbl Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/odysee.html">Odysee</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/openalex.html">OpenAlex</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/openlibrary.html">Open Library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/peertube.html">Peertube Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/piped.html">Piped</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/presearch.html">Presearch Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/pubmed.html">PubMed</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/qwant.html">Qwant</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/radio_browser.html">RadioBrowser</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/recoll.html">Recoll Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/repology.html">Repology</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/reuters.html">Reuters</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/semantic_scholar.html">Semantic Scholar</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/soundcloud.html">Soundcloud</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/sourcehut.html">Sourcehut</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/springer.html">Springer Nature</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/startpage.html">Startpage Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/tagesschau.html">Tagesschau API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/torznab.html">Torznab WebAPI</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/tubearchivist.html">Tube Archivist</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/void.html">Void Linux binary packages</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/wallhaven.html">Wallhaven</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/wikipedia.html">Wikimedia</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/yacy.html">Yacy</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/yahoo.html">Yahoo Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online/zlibrary.html">Z-Library</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/offline_concept.html">Offline Concept</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/demo/demo_offline.html">Demo Offline Engine</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/offline/command-line-engines.html">Command Line Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/offline/nosql-engines.html">NoSQL databases</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/offline/search-indexer-engines.html">Local Search APIs</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/offline/sql-engines.html">SQL Engines</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/engines/online_url_search/tineye.html">Tineye</a></li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../dev/result_types/index.html">Result Types</a><input aria-label="Toggle navigation of Result Types" class="toctree-checkbox" id="toctree-checkbox-6" name="toctree-checkbox-6" role="switch" type="checkbox"/><label for="toctree-checkbox-6"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../dev/result_types/base_result.html">Result</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../dev/result_types/main_result.html">Main Search Results</a><input aria-label="Toggle navigation of Main Search Results" class="toctree-checkbox" id="toctree-checkbox-7" name="toctree-checkbox-7" role="switch" type="checkbox"/><label for="toctree-checkbox-7"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../dev/result_types/main/mainresult.html"><code class="docutils literal notranslate"><span class="pre">MainResult</span></code></a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/result_types/main/keyvalue.html">Key-Value Results</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/result_types/main/code.html">Code Results</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/result_types/main/paper.html">Paper Results</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/result_types/main/file.html">File Results</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/result_types/answer.html">Answer Results</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/result_types/correction.html">Correction Results</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/result_types/suggestion.html">Suggestion Results</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../dev/result_types/infobox.html">Infobox Results</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/templates.html">Simple Theme Templates</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/search_api.html">Search API</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../dev/plugins/index.html">Plugins</a><input aria-label="Toggle navigation of Plugins" class="toctree-checkbox" id="toctree-checkbox-8" name="toctree-checkbox-8" role="switch" type="checkbox"/><label for="toctree-checkbox-8"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../dev/plugins/development.html">Plugin Development</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../dev/plugins/builtins.html">Built-in Plugins</a><input aria-label="Toggle navigation of Built-in Plugins" class="toctree-checkbox" id="toctree-checkbox-9" name="toctree-checkbox-9" role="switch" type="checkbox"/><label for="toctree-checkbox-9"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/calculator.html">Calculator</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/hash_plugin.html">Hash Values</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/hostnames.html">Hostnames</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/infinite_scroll.html">Infinite scroll</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/self_info.html">Self-Info</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/tor_check.html">Tor check</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/unit_converter.html">Unit Converter</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/plugins/time_zone.html">Time Zone</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../dev/answerers/index.html">Answerers</a><input aria-label="Toggle navigation of Answerers" class="toctree-checkbox" id="toctree-checkbox-10" name="toctree-checkbox-10" role="switch" type="checkbox"/><label for="toctree-checkbox-10"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../dev/answerers/development.html">Answerer Development</a></li>
<li class="toctree-l3 has-children"><a class="reference internal" href="../../dev/answerers/builtins.html">Built-in Answerers</a><input aria-label="Toggle navigation of Built-in Answerers" class="toctree-checkbox" id="toctree-checkbox-11" name="toctree-checkbox-11" role="switch" type="checkbox"/><label for="toctree-checkbox-11"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l4"><a class="reference internal" href="../../dev/answerers/random.html">Random</a></li>
<li class="toctree-l4"><a class="reference internal" href="../../dev/answerers/statistics.html">Statistics</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/translation.html">Translation</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/makefile.html">Makefile &amp; <code class="docutils literal notranslate"><span class="pre">./manage</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev/reST.html">reST primer</a></li>
<li class="toctree-l2 has-children"><a class="reference internal" href="../../dev/searxng_extra/index.html">Tooling box <code class="docutils literal notranslate"><span class="pre">searxng_extra</span></code></a><input aria-label="Toggle navigation of Tooling box searxng_extra" class="toctree-checkbox" id="toctree-checkbox-12" name="toctree-checkbox-12" role="switch" type="checkbox"/><label for="toctree-checkbox-12"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l3"><a class="reference internal" href="../../dev/searxng_extra/update.html"><code class="docutils literal notranslate"><span class="pre">searxng_extra/update/</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../utils/index.html">DevOps tooling box</a><input aria-label="Toggle navigation of DevOps tooling box" class="toctree-checkbox" id="toctree-checkbox-13" name="toctree-checkbox-13" role="switch" type="checkbox"/><label for="toctree-checkbox-13"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../utils/searxng.sh.html"><code class="docutils literal notranslate"><span class="pre">utils/searxng.sh</span></code></a></li>
</ul>
</li>
<li class="toctree-l1 has-children"><a class="reference internal" href="../../src/index.html">Source-Code</a><input aria-label="Toggle navigation of Source-Code" class="toctree-checkbox" id="toctree-checkbox-14" name="toctree-checkbox-14" role="switch" type="checkbox"/><label for="toctree-checkbox-14"><span class="icon"><svg><use href="#svg-arrow-right"></use></svg></span></label><ul>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.babel_extract.html">Custom message extractor (i18n)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.botdetection.html">Bot Detection</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.cache.html">Caches</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.exceptions.html">SearXNG Exceptions</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.favicons.html">Favicons (source)</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.infopage.html">Online <code class="docutils literal notranslate"><span class="pre">/info</span></code></a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.locales.html">Locales</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.search.html">Search</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.search.processors.html">Search processors</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.settings.html">Settings Loader</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.sqlitedb.html">SQLite DB</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.utils.html">Utility functions for the engines</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.valkeydb.html">Valkey DB</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.valkeylib.html">Valkey Library</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../src/searx.weather.html">Weather</a></li>
</ul>
</li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<div class="main">
<div class="content">
<div class="article-container">
<a href="#" class="back-to-top muted-link">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
</svg>
<span>Back to top</span>
</a>
<div class="content-icon-container">
<div class="theme-toggle-container theme-toggle-content">
<button class="theme-toggle" aria-label="Toggle Light / Dark / Auto color theme">
<svg class="theme-icon-when-auto-light"><use href="#svg-sun-with-moon"></use></svg>
<svg class="theme-icon-when-auto-dark"><use href="#svg-moon-with-sun"></use></svg>
<svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
<svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
</button>
</div>
<label class="toc-overlay-icon toc-content-icon no-toc" for="__toc">
<span class="icon"><svg><use href="#svg-toc"></use></svg></span>
</label>
</div>
<article role="main" id="furo-main-content">
<h1>Source code for searx.enginelib</h1><div class="highlight"><pre>
<span></span><span class="c1"># SPDX-License-Identifier: AGPL-3.0-or-later</span>
<span class="sd">&quot;&quot;&quot;Implementations of the framework for the SearXNG engines.</span>
<span class="sd">- :py:obj:`searx.enginelib.EngineCache`</span>
<span class="sd">- :py:obj:`searx.enginelib.Engine`</span>
<span class="sd">- :py:obj:`searx.enginelib.traits`</span>
<span class="sd">There is a command line for developer purposes and for deeper analysis. Here is</span>
<span class="sd">an example in which the command line is called in the development environment::</span>
<span class="sd"> $ ./manage pyenv.cmd bash --norc --noprofile</span>
<span class="sd"> (py3) python -m searx.enginelib --help</span>
<span class="sd">.. hint::</span>
<span class="sd"> The long term goal is to modularize all implementations of the engine</span>
<span class="sd"> framework here in this Python package. ToDo:</span>
<span class="sd"> - move implementations of the :ref:`searx.engines loader` to a new module in</span>
<span class="sd"> the :py:obj:`searx.enginelib` namespace.</span>
<span class="sd">-----</span>
<span class="sd">&quot;&quot;&quot;</span>
<span class="n">__all__</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;EngineCache&quot;</span><span class="p">,</span> <span class="s2">&quot;Engine&quot;</span><span class="p">,</span> <span class="s2">&quot;ENGINES_CACHE&quot;</span><span class="p">]</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">typing</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="nn">t</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">abc</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">collections.abc</span><span class="w"> </span><span class="kn">import</span> <span class="n">Callable</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">logging</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">string</span>
<span class="kn">import</span><span class="w"> </span><span class="nn">typer</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">..cache</span><span class="w"> </span><span class="kn">import</span> <span class="n">ExpireCacheSQLite</span><span class="p">,</span> <span class="n">ExpireCacheCfg</span>
<span class="k">if</span> <span class="n">t</span><span class="o">.</span><span class="n">TYPE_CHECKING</span><span class="p">:</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">searx.enginelib</span><span class="w"> </span><span class="kn">import</span> <span class="n">traits</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">searx.enginelib.traits</span><span class="w"> </span><span class="kn">import</span> <span class="n">EngineTraits</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">searx.extended_types</span><span class="w"> </span><span class="kn">import</span> <span class="n">SXNG_Response</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">searx.result_types</span><span class="w"> </span><span class="kn">import</span> <span class="n">EngineResults</span>
<span class="kn">from</span><span class="w"> </span><span class="nn">searx.search.processors</span><span class="w"> </span><span class="kn">import</span> <span class="n">OfflineParamTypes</span><span class="p">,</span> <span class="n">OnlineParamTypes</span>
<span class="n">ENGINES_CACHE</span><span class="p">:</span> <span class="n">ExpireCacheSQLite</span> <span class="o">=</span> <span class="n">ExpireCacheSQLite</span><span class="o">.</span><span class="n">build_cache</span><span class="p">(</span>
<span class="n">ExpireCacheCfg</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="s2">&quot;ENGINES_CACHE&quot;</span><span class="p">,</span>
<span class="n">MAXHOLD_TIME</span><span class="o">=</span><span class="mi">60</span> <span class="o">*</span> <span class="mi">60</span> <span class="o">*</span> <span class="mi">24</span> <span class="o">*</span> <span class="mi">7</span><span class="p">,</span> <span class="c1"># 7 days</span>
<span class="n">MAINTENANCE_PERIOD</span><span class="o">=</span><span class="mi">60</span> <span class="o">*</span> <span class="mi">60</span><span class="p">,</span> <span class="c1"># 2h</span>
<span class="p">)</span>
<span class="p">)</span>
<span class="sd">&quot;&quot;&quot;Global :py:obj:`searx.cache.ExpireCacheSQLite` instance where the cached</span>
<span class="sd">values from all engines are stored. The `MAXHOLD_TIME` is 7 days and the</span>
<span class="sd">`MAINTENANCE_PERIOD` is set to two hours.&quot;&quot;&quot;</span>
<span class="n">app</span> <span class="o">=</span> <span class="n">typer</span><span class="o">.</span><span class="n">Typer</span><span class="p">()</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
<span class="k">def</span><span class="w"> </span><span class="nf">state</span><span class="p">():</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Show state for the caches of the engines.&quot;&quot;&quot;</span>
<span class="n">title</span> <span class="o">=</span> <span class="s2">&quot;cache tables and key/values&quot;</span>
<span class="nb">print</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;=&quot;</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">state</span><span class="p">()</span><span class="o">.</span><span class="n">report</span><span class="p">())</span>
<span class="nb">print</span><span class="p">()</span>
<span class="n">title</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">&quot;properties of </span><span class="si">{</span><span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">cfg</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">&quot;</span>
<span class="nb">print</span><span class="p">(</span><span class="n">title</span><span class="p">)</span>
<span class="nb">print</span><span class="p">(</span><span class="s2">&quot;=&quot;</span> <span class="o">*</span> <span class="nb">len</span><span class="p">(</span><span class="n">title</span><span class="p">))</span>
<span class="nb">print</span><span class="p">(</span><span class="nb">str</span><span class="p">(</span><span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">properties</span><span class="p">))</span>
<span class="nd">@app</span><span class="o">.</span><span class="n">command</span><span class="p">()</span>
<span class="k">def</span><span class="w"> </span><span class="nf">maintenance</span><span class="p">(</span><span class="n">force</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span><span class="p">):</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Carry out maintenance on cache of the engines.&quot;&quot;&quot;</span>
<span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">maintenance</span><span class="p">(</span><span class="n">force</span><span class="o">=</span><span class="n">force</span><span class="p">)</span>
<div class="viewcode-block" id="EngineCache">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.EngineCache">[docs]</a>
<span class="k">class</span><span class="w"> </span><span class="nc">EngineCache</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Persistent (SQLite) key/value cache that deletes its values again after</span>
<span class="sd"> ``expire`` seconds (default/max: :py:obj:`MAXHOLD_TIME</span>
<span class="sd"> &lt;searx.cache.ExpireCacheCfg.MAXHOLD_TIME&gt;`). This class is a wrapper around</span>
<span class="sd"> :py:obj:`ENGINES_CACHE` (:py:obj:`ExpireCacheSQLite</span>
<span class="sd"> &lt;searx.cache.ExpireCacheSQLite&gt;`).</span>
<span class="sd"> In the :origin:`searx/engines/demo_offline.py` engine you can find an</span>
<span class="sd"> exemplary implementation of such a cache other examples are implemented</span>
<span class="sd"> in:</span>
<span class="sd"> - :origin:`searx/engines/radio_browser.py`</span>
<span class="sd"> - :origin:`searx/engines/soundcloud.py`</span>
<span class="sd"> - :origin:`searx/engines/startpage.py`</span>
<span class="sd"> .. code: python</span>
<span class="sd"> from searx.enginelib import EngineCache</span>
<span class="sd"> CACHE: EngineCache</span>
<span class="sd"> def init(engine_settings):</span>
<span class="sd"> global CACHE</span>
<span class="sd"> CACHE = EngineCache(engine_settings[&quot;name&quot;])</span>
<span class="sd"> def request(query, params):</span>
<span class="sd"> token = CACHE.get(key=&quot;token&quot;)</span>
<span class="sd"> if token is None:</span>
<span class="sd"> token = get_token()</span>
<span class="sd"> # cache token of this engine for 1h</span>
<span class="sd"> CACHE.set(key=&quot;token&quot;, value=token, expire=3600)</span>
<span class="sd"> ...</span>
<span class="sd"> For introspection of the DB, jump into developer environment and run command to</span>
<span class="sd"> show cache state::</span>
<span class="sd"> $ ./manage pyenv.cmd bash --norc --noprofile</span>
<span class="sd"> (py3) python -m searx.enginelib cache state</span>
<span class="sd"> cache tables and key/values</span>
<span class="sd"> ===========================</span>
<span class="sd"> [demo_offline ] 2025-04-22 11:32:50 count --&gt; (int) 4</span>
<span class="sd"> [startpage ] 2025-04-22 12:32:30 SC_CODE --&gt; (str) fSOBnhEMlDfE20</span>
<span class="sd"> [duckduckgo ] 2025-04-22 12:32:31 4dff493e.... --&gt; (str) 4-128634958369380006627592672385352473325</span>
<span class="sd"> [duckduckgo ] 2025-04-22 12:40:06 3e2583e2.... --&gt; (str) 4-263126175288871260472289814259666848451</span>
<span class="sd"> [radio_browser ] 2025-04-23 11:33:08 servers --&gt; (list) [&#39;https://de2.api.radio-browser.info&#39;, ...]</span>
<span class="sd"> [soundcloud ] 2025-04-29 11:40:06 guest_client_id --&gt; (str) EjkRJG0BLNEZquRiPZYdNtJdyGtTuHdp</span>
<span class="sd"> [wolframalpha ] 2025-04-22 12:40:06 code --&gt; (str) 5aa79f86205ad26188e0e26e28fb7ae7</span>
<span class="sd"> number of tables: 6</span>
<span class="sd"> number of key/value pairs: 7</span>
<span class="sd"> In the &quot;cache tables and key/values&quot; section, the table name (engine name) is at</span>
<span class="sd"> first position on the second there is the calculated expire date and on the</span>
<span class="sd"> third and fourth position the key/value is shown.</span>
<span class="sd"> About duckduckgo: The *vqd coode* of ddg depends on the query term and therefore</span>
<span class="sd"> the key is a hash value of the query term (to not to store the raw query term).</span>
<span class="sd"> In the &quot;properties of ENGINES_CACHE&quot; section all properties of the SQLiteAppl /</span>
<span class="sd"> ExpireCache and their last modification date are shown::</span>
<span class="sd"> properties of ENGINES_CACHE</span>
<span class="sd"> ===========================</span>
<span class="sd"> [last modified: 2025-04-22 11:32:27] DB_SCHEMA : 1</span>
<span class="sd"> [last modified: 2025-04-22 11:32:27] LAST_MAINTENANCE :</span>
<span class="sd"> [last modified: 2025-04-22 11:32:27] crypt_hash : ca612e3566fdfd7cf7efe...</span>
<span class="sd"> [last modified: 2025-04-22 11:32:30] CACHE-TABLE--demo_offline: demo_offline</span>
<span class="sd"> [last modified: 2025-04-22 11:32:30] CACHE-TABLE--startpage: startpage</span>
<span class="sd"> [last modified: 2025-04-22 11:32:31] CACHE-TABLE--duckduckgo: duckduckgo</span>
<span class="sd"> [last modified: 2025-04-22 11:33:08] CACHE-TABLE--radio_browser: radio_browser</span>
<span class="sd"> [last modified: 2025-04-22 11:40:06] CACHE-TABLE--soundcloud: soundcloud</span>
<span class="sd"> [last modified: 2025-04-22 11:40:06] CACHE-TABLE--wolframalpha: wolframalpha</span>
<span class="sd"> These properties provide information about the state of the ExpireCache and</span>
<span class="sd"> control the behavior. For example, the maintenance intervals are controlled by</span>
<span class="sd"> the last modification date of the LAST_MAINTENANCE property and the hash value</span>
<span class="sd"> of the password can be used to detect whether the password has been changed (in</span>
<span class="sd"> this case the DB entries can no longer be decrypted and the entire cache must be</span>
<span class="sd"> discarded).</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">def</span><span class="w"> </span><span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">engine_name</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">expire</span><span class="p">:</span> <span class="nb">int</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">expire</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="n">expire</span> <span class="ow">or</span> <span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">cfg</span><span class="o">.</span><span class="n">MAXHOLD_TIME</span>
<span class="n">_valid</span> <span class="o">=</span> <span class="s2">&quot;-_.&quot;</span> <span class="o">+</span> <span class="n">string</span><span class="o">.</span><span class="n">ascii_letters</span> <span class="o">+</span> <span class="n">string</span><span class="o">.</span><span class="n">digits</span>
<span class="bp">self</span><span class="o">.</span><span class="n">table_name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">c</span> <span class="k">if</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">_valid</span> <span class="k">else</span> <span class="s2">&quot;_&quot;</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">engine_name</span><span class="p">])</span>
<span class="k">def</span><span class="w"> </span><span class="nf">set</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">value</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">,</span> <span class="n">expire</span><span class="p">:</span> <span class="nb">int</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="k">return</span> <span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">set</span><span class="p">(</span>
<span class="n">key</span><span class="o">=</span><span class="n">key</span><span class="p">,</span>
<span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span>
<span class="n">expire</span><span class="o">=</span><span class="n">expire</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">expire</span><span class="p">,</span>
<span class="n">ctx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">table_name</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">def</span><span class="w"> </span><span class="nf">get</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">key</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">default</span><span class="p">:</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">:</span>
<span class="k">return</span> <span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">default</span><span class="o">=</span><span class="n">default</span><span class="p">,</span> <span class="n">ctx</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">table_name</span><span class="p">)</span>
<span class="k">def</span><span class="w"> </span><span class="nf">secret_hash</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="nb">bytes</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
<span class="k">return</span> <span class="n">ENGINES_CACHE</span><span class="o">.</span><span class="n">secret_hash</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span></div>
<div class="viewcode-block" id="Engine">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine">[docs]</a>
<span class="k">class</span><span class="w"> </span><span class="nc">Engine</span><span class="p">(</span><span class="n">abc</span><span class="o">.</span><span class="n">ABC</span><span class="p">):</span> <span class="c1"># pylint: disable=too-few-public-methods</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Class of engine instances build from YAML settings.</span>
<span class="sd"> Further documentation see :ref:`general engine configuration`.</span>
<span class="sd"> .. hint::</span>
<span class="sd"> This class is currently never initialized and only used for type hinting.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">logger</span><span class="p">:</span> <span class="n">logging</span><span class="o">.</span><span class="n">Logger</span>
<span class="c1"># Common options in the engine module</span>
<span class="n">engine_type</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Type of the engine (:ref:`searx.search.processors`)&quot;&quot;&quot;</span>
<span class="n">paging</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Engine supports multiple pages.&quot;&quot;&quot;</span>
<span class="n">max_page</span><span class="p">:</span> <span class="nb">int</span> <span class="o">=</span> <span class="mi">0</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;If the engine supports paging, then this is the value for the last page</span>
<span class="sd"> that is still supported. ``0`` means unlimited numbers of pages.&quot;&quot;&quot;</span>
<span class="n">time_range_support</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Engine supports search time range.&quot;&quot;&quot;</span>
<span class="n">safesearch</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Engine supports SafeSearch&quot;&quot;&quot;</span>
<span class="n">language_support</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Engine supports languages (locales) search.&quot;&quot;&quot;</span>
<span class="n">language</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;For an engine, when there is ``language: ...`` in the YAML settings the engine</span>
<span class="sd"> does support only this one language:</span>
<span class="sd"> .. code:: yaml</span>
<span class="sd"> - name: google french</span>
<span class="sd"> engine: google</span>
<span class="sd"> language: fr</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">region</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;For an engine, when there is ``region: ...`` in the YAML settings the engine</span>
<span class="sd"> does support only this one region::</span>
<span class="sd"> .. code:: yaml</span>
<span class="sd"> - name: google belgium</span>
<span class="sd"> engine: google</span>
<span class="sd"> region: fr-BE</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">fetch_traits</span><span class="p">:</span> <span class="s2">&quot;Callable[[EngineTraits, bool], None]&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Function to to fetch engine&#39;s traits from origin.&quot;&quot;&quot;</span>
<span class="n">traits</span><span class="p">:</span> <span class="s2">&quot;traits.EngineTraits&quot;</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Traits of the engine.&quot;&quot;&quot;</span>
<span class="c1"># settings.yml</span>
<span class="n">categories</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Specifies to which :ref:`engine categories` the engine should be added.&quot;&quot;&quot;</span>
<span class="n">name</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Name that will be used across SearXNG to define this engine. In settings, on</span>
<span class="sd"> the result page ..&quot;&quot;&quot;</span>
<span class="n">engine</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Name of the python file used to handle requests and responses to and from</span>
<span class="sd"> this search engine (file name from :origin:`searx/engines` without</span>
<span class="sd"> ``.py``).&quot;&quot;&quot;</span>
<span class="n">enable_http</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Enable HTTP (by default only HTTPS is enabled).&quot;&quot;&quot;</span>
<span class="n">shortcut</span><span class="p">:</span> <span class="nb">str</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Code used to execute bang requests (``!foo``)&quot;&quot;&quot;</span>
<span class="n">timeout</span><span class="p">:</span> <span class="nb">float</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Specific timeout for search-engine.&quot;&quot;&quot;</span>
<span class="n">display_error_messages</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Display error messages on the web UI.&quot;&quot;&quot;</span>
<span class="n">proxies</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Set proxies for a specific engine (YAML):</span>
<span class="sd"> .. code:: yaml</span>
<span class="sd"> proxies :</span>
<span class="sd"> http: socks5://proxy:port</span>
<span class="sd"> https: socks5://proxy:port</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">disabled</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;To disable by default the engine, but not deleting it. It will allow the</span>
<span class="sd"> user to manually activate it in the settings.&quot;&quot;&quot;</span>
<span class="n">inactive</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Remove the engine from the settings (*disabled &amp; removed*).&quot;&quot;&quot;</span>
<span class="n">about</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="nb">str</span><span class="p">]]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Additional fields describing the engine.</span>
<span class="sd"> .. code:: yaml</span>
<span class="sd"> about:</span>
<span class="sd"> website: https://example.com</span>
<span class="sd"> wikidata_id: Q306656</span>
<span class="sd"> official_api_documentation: https://example.com/api-doc</span>
<span class="sd"> use_official_api: true</span>
<span class="sd"> require_api_key: true</span>
<span class="sd"> results: HTML</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="n">using_tor_proxy</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Using tor proxy (``true``) or not (``false``) for this engine.&quot;&quot;&quot;</span>
<span class="n">send_accept_language_header</span><span class="p">:</span> <span class="nb">bool</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;When this option is activated (default), the language (locale) that is</span>
<span class="sd"> selected by the user is used to build and send a ``Accept-Language`` header</span>
<span class="sd"> in the request to the origin search engine.&quot;&quot;&quot;</span>
<span class="n">tokens</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;A list of secret tokens to make this engine *private*, more details see</span>
<span class="sd"> :ref:`private engines`.&quot;&quot;&quot;</span>
<span class="n">weight</span><span class="p">:</span> <span class="nb">int</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Weighting of the results of this engine (:ref:`weight &lt;settings engines&gt;`).&quot;&quot;&quot;</span>
<div class="viewcode-block" id="Engine.setup">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine.setup">[docs]</a>
<span class="k">def</span><span class="w"> </span><span class="nf">setup</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">engine_settings</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span> <span class="c1"># pylint: disable=unused-argument</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Dynamic setup of the engine settings.</span>
<span class="sd"> With this method, the engine&#39;s setup is carried out. For example, to</span>
<span class="sd"> check or dynamically adapt the values handed over in the parameter</span>
<span class="sd"> ``engine_settings``. The return value (True/False) indicates whether</span>
<span class="sd"> the setup was successful and the engine can be built or rejected.</span>
<span class="sd"> The method is optional and is called synchronously as part of the</span>
<span class="sd"> initialization of the service and is therefore only suitable for simple</span>
<span class="sd"> (local) exams/changes at the engine setting. The :py:obj:`Engine.init`</span>
<span class="sd"> method must be used for longer tasks in which values of a remote must be</span>
<span class="sd"> determined, for example.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="kc">True</span></div>
<div class="viewcode-block" id="Engine.init">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine.init">[docs]</a>
<span class="k">def</span><span class="w"> </span><span class="nf">init</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">engine_settings</span><span class="p">:</span> <span class="nb">dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">t</span><span class="o">.</span><span class="n">Any</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="nb">bool</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span> <span class="c1"># pylint: disable=unused-argument</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Initialization of the engine.</span>
<span class="sd"> The method is optional and asynchronous (in a thread). It is suitable,</span>
<span class="sd"> for example, for setting up a cache (for the engine) or for querying</span>
<span class="sd"> values (required by the engine) from a remote.</span>
<span class="sd"> Whether the initialization was successful can be indicated by the return</span>
<span class="sd"> value ``True`` or even ``False``.</span>
<span class="sd"> - If no return value is given from this init method (``None``), this is</span>
<span class="sd"> equivalent to ``True``.</span>
<span class="sd"> - If an exception is thrown as part of the initialization, this is</span>
<span class="sd"> equivalent to ``False``.</span>
<span class="sd"> &quot;&quot;&quot;</span>
<span class="k">return</span> <span class="kc">True</span></div>
<div class="viewcode-block" id="Engine.search">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine.search">[docs]</a>
<span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
<span class="k">def</span><span class="w"> </span><span class="nf">search</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">params</span><span class="p">:</span> <span class="s2">&quot;OfflineParamTypes&quot;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="s2">&quot;EngineResults&quot;</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Search method of the ``offline`` engines&quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="Engine.request">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine.request">[docs]</a>
<span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
<span class="k">def</span><span class="w"> </span><span class="nf">request</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">query</span><span class="p">:</span> <span class="nb">str</span><span class="p">,</span> <span class="n">params</span><span class="p">:</span> <span class="s2">&quot;OnlineParamTypes&quot;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Method to build the parameters for the request of an ``online``</span>
<span class="sd"> engine.&quot;&quot;&quot;</span></div>
<div class="viewcode-block" id="Engine.response">
<a class="viewcode-back" href="../../dev/engines/enginelib.html#searx.enginelib.Engine.response">[docs]</a>
<span class="nd">@abc</span><span class="o">.</span><span class="n">abstractmethod</span>
<span class="k">def</span><span class="w"> </span><span class="nf">response</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">resp</span><span class="p">:</span> <span class="s2">&quot;SXNG_Response&quot;</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="s2">&quot;EngineResults&quot;</span><span class="p">:</span>
<span class="w"> </span><span class="sd">&quot;&quot;&quot;Method to parse the response of an ``online`` engine.&quot;&quot;&quot;</span></div>
</div>
</pre></div>
</article>
</div>
<footer>
<div class="related-pages">
</div>
<div class="bottom-of-page">
<div class="left-details">
<div class="copyright">
Copyright &#169; SearXNG team
</div>
Made with
<a href="https://github.com/pradyunsg/furo">Furo</a>
</div>
<div class="right-details">
<div class="icons">
<a class="muted-link " href="https://github.com/searxng/searxng/" aria-label="GitHub">&#x1F4BE;</a>
<a class="muted-link " href="https://searx.space/" aria-label="searx.space">&#x1F310;</a>
</div>
</div>
</div>
</footer>
</div>
<aside class="toc-drawer no-toc">
</aside>
</div>
</div><script src="../../_static/documentation_options.js?v=d004a72a"></script>
<script src="../../_static/doctools.js?v=fd6eb6e6"></script>
<script src="../../_static/sphinx_highlight.js?v=6ffebe34"></script>
<script src="../../_static/scripts/furo.js?v=46bd48cc"></script>
</body>
</html>