[MM-38216] Add API endpoint and adapt search to allow multi-team search (#18371)

* Add API endpoint and adapt search to allow multi-team search

* Refactor handler, refactor sql query to use squirrel, rename app and store functions and add tests

* Fix lint

* Fix search engines and remove unneeded comments

* Fix test

* Remove user from channel after test
Этот коммит содержится в:
Daniel Espino García
2021-09-23 14:43:09 +02:00
коммит произвёл GitHub
родитель 8c62cf6e3d
Коммит 02a9ef3f82
19 изменённых файлов: 350 добавлений и 273 удалений

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

@@ -5193,10 +5193,10 @@ func (s *TimerLayerPostStore) Search(teamID string, userID string, params *model
return result, err
}
func (s *TimerLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.PostSearchResults, error) {
func (s *TimerLayerPostStore) SearchPostsForUser(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.PostSearchResults, error) {
start := timemodule.Now()
result, err := s.PostStore.SearchPostsInTeamForUser(paramsList, userID, teamID, page, perPage)
result, err := s.PostStore.SearchPostsForUser(paramsList, userID, teamID, page, perPage)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
@@ -5204,7 +5204,7 @@ func (s *TimerLayerPostStore) SearchPostsInTeamForUser(paramsList []*model.Searc
if err == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("PostStore.SearchPostsInTeamForUser", success, elapsed)
s.Root.Metrics.ObserveStoreMethodDuration("PostStore.SearchPostsForUser", success, elapsed)
}
return result, err
}