summary refs log tree commit diff
path: root/synapse/storage
diff options
context:
space:
mode:
authorTravis Ralston <travpc@gmail.com>2018-12-04 04:01:02 -0700
committerRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-12-04 12:01:02 +0100
commit158ffb92f1ba0e247fb0a71f0d400655643ae68e (patch)
tree3ccda597fbe020866a6dc4fb7da53f64d19f845d /synapse/storage
parentAdd note to UPGRADE.rst about removing riot.im from list of trusted identity ... (diff)
downloadsynapse-158ffb92f1ba0e247fb0a71f0d400655643ae68e.tar.xz
Add an option to disable search for homeservers which may not be interested in it (#4230)
This is useful for homeservers not intended for users, such as bot-only homeservers or ones that only process IoT data.
Diffstat (limited to 'synapse/storage')
-rw-r--r--synapse/storage/search.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/search.py b/synapse/storage/search.py
index d5b5df93e6..c6420b2374 100644
--- a/synapse/storage/search.py
+++ b/synapse/storage/search.py
@@ -45,6 +45,10 @@ class SearchStore(BackgroundUpdateStore):
 
     def __init__(self, db_conn, hs):
         super(SearchStore, self).__init__(db_conn, hs)
+
+        if not hs.config.enable_search:
+            return
+
         self.register_background_update_handler(
             self.EVENT_SEARCH_UPDATE_NAME, self._background_reindex_search
         )
@@ -316,6 +320,8 @@ class SearchStore(BackgroundUpdateStore):
             entries (iterable[SearchEntry]):
                 entries to be added to the table
         """
+        if not self.hs.config.enable_search:
+            return
         if isinstance(self.database_engine, PostgresEngine):
             sql = (
                 "INSERT INTO event_search"