no-sql-engines.rst.txt 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. ===========================
  2. Query SQL and NoSQL servers
  3. ===========================
  4. SQL
  5. ===
  6. SQL servers are traditional databases with predefined data schema. Furthermore,
  7. modern versions also support BLOB data.
  8. You can search in the following servers:
  9. * `PostgreSQL`_
  10. * `MySQL`_
  11. * `SQLite`_
  12. The configuration of the new database engines are similar. You must put a valid
  13. SELECT SQL query in ``query_str``. At the moment you can only bind at most
  14. one parameter in your query.
  15. Do not include LIMIT or OFFSET in your SQL query as the engines
  16. rely on these keywords during paging.
  17. PostgreSQL
  18. ----------
  19. Required PyPi package: ``psychopg2``
  20. You can find an example configuration below:
  21. .. code:: yaml
  22. - name : postgresql
  23. engine : postgresql
  24. database : my_database
  25. username : searx
  26. password : password
  27. query_str : 'SELECT * from my_table WHERE my_column = %(query)s'
  28. shortcut : psql
  29. Available options
  30. ~~~~~~~~~~~~~~~~~
  31. * ``host``: IP address of the host running PostgreSQL. By default it is ``127.0.0.1``.
  32. * ``port``: Port number PostgreSQL is listening on. By default it is ``5432``.
  33. * ``database``: Name of the database you are connecting to.
  34. * ``username``: Name of the user connecting to the database.
  35. * ``password``: Password of the database user.
  36. * ``query_str``: Query string to run. Keywords like ``LIMIT`` and ``OFFSET`` are not allowed. Required.
  37. * ``limit``: Number of returned results per page. By default it is 10.
  38. MySQL
  39. -----
  40. Required PyPi package: ``mysql-connector-python``
  41. This is an example configuration for quering a MySQL server:
  42. .. code:: yaml
  43. - name : mysql
  44. engine : mysql_server
  45. database : my_database
  46. username : searx
  47. password : password
  48. limit : 5
  49. query_str : 'SELECT * from my_table WHERE my_column=%(query)s'
  50. shortcut : mysql
  51. Available options
  52. ~~~~~~~~~~~~~~~~~
  53. * ``host``: IP address of the host running MySQL. By default it is ``127.0.0.1``.
  54. * ``port``: Port number MySQL is listening on. By default it is ``3306``.
  55. * ``database``: Name of the database you are connecting to.
  56. * ``auth_plugin``: Authentication plugin to use. By default it is ``caching_sha2_password``.
  57. * ``username``: Name of the user connecting to the database.
  58. * ``password``: Password of the database user.
  59. * ``query_str``: Query string to run. Keywords like ``LIMIT`` and ``OFFSET`` are not allowed. Required.
  60. * ``limit``: Number of returned results per page. By default it is 10.
  61. SQLite
  62. ------
  63. You can read from your database ``my_database`` using this example configuration:
  64. .. code:: yaml
  65. - name : sqlite
  66. engine : sqlite
  67. shortcut: sq
  68. database : my_database
  69. query_str : 'SELECT * FROM my_table WHERE my_column=:query'
  70. Available options
  71. ~~~~~~~~~~~~~~~~~
  72. * ``database``: Name of the database you are connecting to.
  73. * ``query_str``: Query string to run. Keywords like ``LIMIT`` and ``OFFSET`` are not allowed. Required.
  74. * ``limit``: Number of returned results per page. By default it is 10.
  75. NoSQL
  76. =====
  77. NoSQL data stores are used for storing arbitrary data without first defining their
  78. structure. To query the supported servers, you must install their drivers using PyPi.
  79. You can search in the following servers:
  80. * `Redis`_
  81. * `MongoDB`_
  82. Redis
  83. -----
  84. Reqired PyPi package: ``redis``
  85. Example configuration:
  86. .. code:: yaml
  87. - name : mystore
  88. engine : redis_server
  89. exact_match_only : True
  90. host : 127.0.0.1
  91. port : 6379
  92. password : secret-password
  93. db : 0
  94. shortcut : rds
  95. enable_http : True
  96. Available options
  97. ~~~~~~~~~~~~~~~~~
  98. * ``host``: IP address of the host running Redis. By default it is ``127.0.0.1``.
  99. * ``port``: Port number Redis is listening on. By default it is ``6379``.
  100. * ``password``: Password if required by Redis.
  101. * ``db``: Number of the database you are connecting to.
  102. * ``exact_match_only``: Enable if you need exact matching. By default it is ``True``.
  103. MongoDB
  104. -------
  105. Required PyPi package: ``pymongo``
  106. Below is an example configuration for using a MongoDB collection:
  107. .. code:: yaml
  108. - name : mymongo
  109. engine : mongodb
  110. shortcut : icm
  111. host : '127.0.0.1'
  112. port : 27017
  113. database : personal
  114. collection : income
  115. key : month
  116. enable_http: True
  117. Available options
  118. ~~~~~~~~~~~~~~~~~
  119. * ``host``: IP address of the host running MongoDB. By default it is ``127.0.0.1``.
  120. * ``port``: Port number MongoDB is listening on. By default it is ``27017``.
  121. * ``password``: Password if required by Redis.
  122. * ``database``: Name of the database you are connecting to.
  123. * ``collection``: Name of the collection you want to search in.
  124. * ``exact_match_only``: Enable if you need exact matching. By default it is ``True``.