diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2023-06-30 18:07:02 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2023-07-01 22:45:19 +0200 |
commit | 5720844fcdc8601798e10544e2fd25ce4f2ad099 (patch) | |
tree | af611e4aef436253f4fda9504d06e05e2621114d /searx/engines/mongodb.py | |
parent | 8e8d8dabe9b17c9db8db7432c6bc063d9ae980d1 (diff) | |
download | searxng-5720844fcdc8601798e10544e2fd25ce4f2ad099.tar.gz searxng-5720844fcdc8601798e10544e2fd25ce4f2ad099.zip |
[doc] rearranges Settings & Engines docs for better readability
We have built up detailed documentation of the *settings* and the *engines* over
the past few years. However, this documentation was still spread over various
chapters and was difficult to navigate in its entirety.
This patch rearranges the Settings & Engines documentation for better
readability.
To review new ordered docs::
make docs.clean docs.live
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/mongodb.py')
-rw-r--r-- | searx/engines/mongodb.py | 46 |
1 files changed, 44 insertions, 2 deletions
diff --git a/searx/engines/mongodb.py b/searx/engines/mongodb.py index 63452bb68..260d6da97 100644 --- a/searx/engines/mongodb.py +++ b/searx/engines/mongodb.py @@ -1,11 +1,53 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""MongoDB engine (Offline) +"""MongoDB_ is a document based database program that handles JSON like data. +Before configuring the ``mongodb`` engine, you must install the dependency +pymongo_. + +Configuration +============= + +In order to query MongoDB_, you have to select a ``database`` and a +``collection``. Furthermore, you have to select a ``key`` that is going to be +searched. MongoDB_ also supports the option ``exact_match_only``, so configure +it as you wish. + +Example +======= + +Below is an example configuration for using a MongoDB collection: + +.. code:: yaml + + # MongoDB engine + # Required dependency: pymongo + + - name: mymongo + engine: mongodb + shortcut: md + exact_match_only: false + host: '127.0.0.1' + port: 27017 + enable_http: true + results_per_page: 20 + database: 'business' + collection: 'reviews' # name of the db collection + key: 'name' # key in the collection to search for + +Implementations +=============== """ import re -from pymongo import MongoClient # pyright: ignore # pylint: disable=import-error + +try: + from pymongo import MongoClient # type: ignore +except ImportError: + # import error is ignored because the admin has to install pymongo manually + # to use the engine + pass + engine_type = 'offline' |