search-database-engines.html 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <meta name="viewport" content="width=device-width, initial-scale=1">
  7. <title>Query more of your NoSQL stores &#8212; Searx Documentation (Searx-1.1.0.tex)</title>
  8. <link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
  9. <link rel="stylesheet" type="text/css" href="../_static/searx.css" />
  10. <link rel="stylesheet" type="text/css" href="../_static/tabs.css" />
  11. <script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
  12. <script src="../_static/jquery.js"></script>
  13. <script src="../_static/underscore.js"></script>
  14. <script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
  15. <script src="../_static/doctools.js"></script>
  16. <script src="../_static/sphinx_highlight.js"></script>
  17. <link rel="index" title="Index" href="../genindex.html" />
  18. <link rel="search" title="Search" href="../search.html" />
  19. <link rel="next" title="Query SQL servers" href="sql-engines.html" />
  20. <link rel="prev" title="Private searx project is finished" href="documentation-offline-engines.html" />
  21. </head><body>
  22. <div class="related" role="navigation" aria-label="related navigation">
  23. <h3>Navigation</h3>
  24. <ul>
  25. <li class="right" style="margin-right: 10px">
  26. <a href="../genindex.html" title="General Index"
  27. accesskey="I">index</a></li>
  28. <li class="right" >
  29. <a href="../py-modindex.html" title="Python Module Index"
  30. >modules</a> |</li>
  31. <li class="right" >
  32. <a href="sql-engines.html" title="Query SQL servers"
  33. accesskey="N">next</a> |</li>
  34. <li class="right" >
  35. <a href="documentation-offline-engines.html" title="Private searx project is finished"
  36. accesskey="P">previous</a> |</li>
  37. <li class="nav-item nav-item-0"><a href="../index.html">Searx Documentation (Searx-1.1.0.tex)</a> &#187;</li>
  38. <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">Blog</a> &#187;</li>
  39. <li class="nav-item nav-item-this"><a href="">Query more of your NoSQL stores</a></li>
  40. </ul>
  41. </div>
  42. <div class="document">
  43. <div class="documentwrapper">
  44. <div class="bodywrapper">
  45. <div class="body" role="main">
  46. <section id="query-more-of-your-nosql-stores">
  47. <h1>Query more of your NoSQL stores<a class="headerlink" href="#query-more-of-your-nosql-stores" title="Permalink to this heading">¶</a></h1>
  48. <p>From now on, searx lets you to query your NoSQL data stores:</p>
  49. <ul class="simple">
  50. <li><p><a class="reference external" href="https://redis.io/">Redis</a></p></li>
  51. <li><p><a class="reference external" href="https://mongodb.com/">MongoDB</a></p></li>
  52. </ul>
  53. <p>The reference configuration of the engines are included <code class="docutils literal notranslate"><span class="pre">settings.yml</span></code> just commented out,
  54. as you have to set various options and install dependencies before using them.</p>
  55. <p>By default, the engines use <code class="docutils literal notranslate"><span class="pre">key-value</span></code> template for displaying results.
  56. If you are not satisfied with the original result layout,
  57. you can use your owm template by placing the template under
  58. <code class="docutils literal notranslate"><span class="pre">searx/templates/{theme_name}/result_templates/{template_name}</span></code> and setting
  59. <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>.</p>
  60. <p>Furthermore, if you do not want to expose these engines on a public instance, you can
  61. still add them and limit the access by setting <code class="docutils literal notranslate"><span class="pre">tokens</span></code> as described in the <a class="reference external" href="private-engines.html#private-engines">blog post about
  62. private engines</a>.</p>
  63. <section id="configuring-searx-to-use-the-stores">
  64. <h2>Configuring searx to use the stores<a class="headerlink" href="#configuring-searx-to-use-the-stores" title="Permalink to this heading">¶</a></h2>
  65. <p>NoSQL data stores are used for storing arbitrary data without first defining their
  66. structure.</p>
  67. <section id="redis">
  68. <h3>Redis<a class="headerlink" href="#redis" title="Permalink to this heading">¶</a></h3>
  69. <p>Required package: <code class="docutils literal notranslate"><span class="pre">redis</span></code></p>
  70. <p>Redis is a key value based data store usually stored in memory.</p>
  71. <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
  72. either look for exact matches or use partial keywords to find what you are looking for
  73. by configuring <code class="docutils literal notranslate"><span class="pre">exact_match_only</span></code>.</p>
  74. <p>In this example you can search for exact matches in your first database:</p>
  75. <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">mystore</span><span class="w"></span>
  76. <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>
  77. <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">True</span><span class="w"></span>
  78. <span class="w"> </span><span class="nt">host </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">127.0.0.1</span><span class="w"></span>
  79. <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>
  80. <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">secret-password</span><span class="w"></span>
  81. <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><span class="w"></span>
  82. <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>
  83. <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>
  84. </pre></div>
  85. </div>
  86. </section>
  87. <section id="mongodb">
  88. <h3>MongoDB<a class="headerlink" href="#mongodb" title="Permalink to this heading">¶</a></h3>
  89. <p>Required package: <code class="docutils literal notranslate"><span class="pre">pymongo</span></code></p>
  90. <p>MongoDB is a document based database program that handles JSON like data.</p>
  91. <p>In order to query MongoDB, 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,
  92. you have to select a <code class="docutils literal notranslate"><span class="pre">key</span></code> that is going to be searched. MongoDB also supports the option <code class="docutils literal notranslate"><span class="pre">exact_match_only</span></code>, so configure it
  93. as you wish.</p>
  94. <p>Above is an example configuration for using a MongoDB collection:</p>
  95. <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">mymongo</span><span class="w"></span>
  96. <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>
  97. <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>
  98. <span class="w"> </span><span class="nt">host </span><span class="p">:</span><span class="w"> </span><span class="s">&#39;127.0.0.1&#39;</span><span class="w"></span>
  99. <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>
  100. <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">personal</span><span class="w"></span>
  101. <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">income</span><span class="w"></span>
  102. <span class="w"> </span><span class="nt">key </span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">month</span><span class="w"></span>
  103. <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>
  104. </pre></div>
  105. </div>
  106. </section>
  107. </section>
  108. <section id="acknowledgement">
  109. <h2>Acknowledgement<a class="headerlink" href="#acknowledgement" title="Permalink to this heading">¶</a></h2>
  110. <p>This development was 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>
  111. <div class="line-block">
  112. <div class="line">Happy hacking.</div>
  113. <div class="line">kvch // 2021.07.13 23:16</div>
  114. </div>
  115. </section>
  116. </section>
  117. <div class="clearer"></div>
  118. </div>
  119. </div>
  120. </div>
  121. <span id="sidebar-top"></span>
  122. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  123. <div class="sphinxsidebarwrapper">
  124. <p class="logo"><a href="../index.html">
  125. <img class="logo" src="../_static/searx_logo_small.png" alt="Logo"/>
  126. </a></p>
  127. <h3>Project Links</h3>
  128. <ul>
  129. <li><a href="https://searx.github.io/searx/blog/index.html">Blog</a>
  130. <li><a href="https://github.com/searx/searx">Source</a>
  131. <li><a href="https://github.com/searx/searx/wiki">Wiki</a>
  132. <li><a href="https://twitter.com/Searx_engine">Twitter</a>
  133. <li><a href="https://github.com/searx/searx/issues">Issue Tracker</a>
  134. </ul><h3>Navigation</h3>
  135. <ul>
  136. <li><a href="../index.html">Overview</a>
  137. <ul>
  138. <li><a href="index.html">Blog</a>
  139. <ul>
  140. <li>Previous: <a href="documentation-offline-engines.html" title="previous chapter">Private searx project is finished</a>
  141. <li>Next: <a href="sql-engines.html" title="next chapter">Query SQL servers</a></ul>
  142. </li>
  143. </ul>
  144. </li>
  145. </ul>
  146. <div id="searchbox" style="display: none" role="search">
  147. <h3 id="searchlabel">Quick search</h3>
  148. <div class="searchformwrapper">
  149. <form class="search" action="../search.html" method="get">
  150. <input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
  151. <input type="submit" value="Go" />
  152. </form>
  153. </div>
  154. </div>
  155. <script>document.getElementById('searchbox').style.display = "block"</script>
  156. </div>
  157. </div>
  158. <div class="clearer"></div>
  159. </div>
  160. <div class="footer" role="contentinfo">
  161. &#169; Copyright 2015-2022, Adam Tauber, Noémi Ványi.
  162. Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 5.3.0.
  163. </div>
  164. <script src="../_static/version_warning_offset.js"></script>
  165. </body>
  166. </html>