MM-16543 Fix Elasticsearch only returning one page of results (#11528)

* MM-16543 Add mocking for einterfaces packages

* MM-16543 Fix Elasticsearch only returning one page of results

* Remove license checks for einterface mocks
Этот коммит содержится в:
Harrison Healey
2019-07-08 11:32:29 -04:00
коммит произвёл Christopher Speller
родитель c0b51b03de
Коммит 673ed02a0d
20 изменённых файлов: 1733 добавлений и 10 удалений

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

@@ -1012,6 +1012,10 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
var err *model.AppError
paramsList := model.ParseSearchParams(strings.TrimSpace(terms), timeZoneOffset)
if !*a.Config().ServiceSettings.EnablePostSearch {
return nil, model.NewAppError("SearchPostsInTeamForUser", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented)
}
if a.IsESSearchEnabled() {
postSearchResults, err = a.esSearchPostsInTeamForUser(paramsList, userId, teamId, isOrSearch, includeDeletedChannels, page, perPage)
if err != nil {
@@ -1019,16 +1023,12 @@ func (a *App) SearchPostsInTeamForUser(terms string, userId string, teamId strin
}
}
if !*a.Config().ServiceSettings.EnablePostSearch {
return nil, model.NewAppError("SearchPostsInTeamForUser", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented)
}
// Since we don't support paging we just return nothing for later pages
if page > 0 {
return model.MakePostSearchResults(model.NewPostList(), nil), nil
}
if !a.IsESSearchEnabled() || err != nil {
// Since we don't support paging for DB search, we just return nothing for later pages
if page > 0 {
return model.MakePostSearchResults(model.NewPostList(), nil), nil
}
includeDeleted := includeDeletedChannels && *a.Config().TeamSettings.ExperimentalViewArchivedChannels
posts, err := a.searchPostsInTeam(teamId, userId, paramsList, func(params *model.SearchParams) {
params.IncludeDeletedChannels = includeDeleted