[MM-23535] Add disable database search flag and return empty posts results if set (#14245)

* [MM-23535] Add disable database search flag and return empty posts results if set

* Add UpdateConfig function for the SearchStore and hook it into the app lifecycle

* Add the config listener in the server instance instead of using FakeApp

* Instantiate searchlayer as a pointer to avoid passing around copies of it
Этот коммит содержится в:
Miguel de la Cruz
2020-05-13 14:00:57 +02:00
коммит произвёл GitHub
родитель 288ed40e8f
Коммит 4fde004a5b
6 изменённых файлов: 47 добавлений и 22 удалений

Просмотреть файл

@@ -121,6 +121,12 @@ func (s SearchPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchPara
return results, err
}
}
if *s.rootStore.config.SqlSettings.DisableDatabaseSearch {
mlog.Debug("Returning empty results for post SearchPostsInTeam as the database search is disabled")
return &model.PostSearchResults{PostList: model.NewPostList(), Matches: model.PostSearchMatches{}}, nil
}
mlog.Debug("Using database search because no other search engine is available")
return s.PostStore.SearchPostsInTeamForUser(paramsList, userId, teamId, isOrSearch, includeDeletedChannels, page, perPage)
}