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.
This commit is contained in:
Travis Ralston 2018-12-04 04:01:02 -07:00 committed by Richard van der Hoff
parent 512e94d230
commit 158ffb92f1
4 changed files with 21 additions and 1 deletions

View file

@ -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"