search-database-engines.rst 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. ===============================
  2. Query more of your NoSQL stores
  3. ===============================
  4. From now on, searx lets you to query your NoSQL data stores:
  5. * `Redis`_
  6. * `MongoDB`_
  7. The reference configuration of the engines are included ``settings.yml`` just commented out,
  8. as you have to set various options and install dependencies before using them.
  9. By default, the engines use ``key-value`` template for displaying results.
  10. If you are not satisfied with the original result layout,
  11. you can use your owm template by placing the template under
  12. ``searx/templates/{theme_name}/result_templates/{template_name}`` and setting
  13. ``result_template`` attribute to ``{template_name}``.
  14. Furthermore, if you do not want to expose these engines on a public instance, you can
  15. still add them and limit the access by setting ``tokens`` as described in the `blog post about
  16. private engines`_.
  17. Configuring searx to use the stores
  18. ===================================
  19. NoSQL data stores are used for storing arbitrary data without first defining their
  20. structure.
  21. Redis
  22. -----
  23. Required package: ``redis``
  24. Redis is a key value based data store usually stored in memory.
  25. Select a database to search in and set its index in the option ``db``. You can
  26. either look for exact matches or use partial keywords to find what you are looking for
  27. by configuring ``exact_match_only``.
  28. In this example you can search for exact matches in your first database:
  29. .. code:: yaml
  30. - name : mystore
  31. engine : redis_server
  32. exact_match_only : True
  33. host : 127.0.0.1
  34. port : 6379
  35. password : secret-password
  36. db : 0
  37. shortcut : rds
  38. enable_http : True
  39. MongoDB
  40. -------
  41. Required package: ``pymongo``
  42. MongoDB is a document based database program that handles JSON like data.
  43. In order to query MongoDB, you have to select a ``database`` and a ``collection``. Furthermore,
  44. you have to select a ``key`` that is going to be searched. MongoDB also supports the option ``exact_match_only``, so configure it
  45. as you wish.
  46. Above is an example configuration for using a MongoDB collection:
  47. .. code:: yaml
  48. - name : mymongo
  49. engine : mongodb
  50. shortcut : md
  51. host : '127.0.0.1'
  52. port : 27017
  53. database : personal
  54. collection : income
  55. key : month
  56. enable_http: True
  57. Acknowledgement
  58. ===============
  59. This development was sponsored by `Search and Discovery Fund`_ of `NLnet Foundation`_ .
  60. .. _Redis: https://redis.io/
  61. .. _MongoDB: https://mongodb.com/
  62. .. _blog post about private engines: private-engines.html#private-engines
  63. .. _Search and Discovery Fund: https://nlnet.nl/discovery
  64. .. _NLnet Foundation: https://nlnet.nl/
  65. | Happy hacking.
  66. | kvch // 2021.07.13 23:16