Fixing non elastic search paging. (#9471)
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
15d9f10f43
Коммит
4546423427
@@ -1343,6 +1343,20 @@ func TestSearchPosts(t *testing.T) {
|
|||||||
assert.Equal(t, posts.Order[0], posts2.Order[0])
|
assert.Equal(t, posts.Order[0], posts2.Order[0])
|
||||||
assert.Equal(t, posts.Order[1], posts2.Order[1])
|
assert.Equal(t, posts.Order[1], posts2.Order[1])
|
||||||
|
|
||||||
|
page = 1
|
||||||
|
searchParams = model.SearchParameter{
|
||||||
|
Terms: &terms,
|
||||||
|
IsOrSearch: &isOrSearch,
|
||||||
|
TimeZoneOffset: &timezoneOffset,
|
||||||
|
Page: &page,
|
||||||
|
PerPage: &perPage,
|
||||||
|
}
|
||||||
|
posts2, resp = Client.SearchPostsWithParams(th.BasicTeam.Id, &searchParams)
|
||||||
|
CheckNoError(t, resp)
|
||||||
|
if len(posts2.Order) != 0 { // We don't support paging for DB search yet, modify this when we do.
|
||||||
|
t.Fatal("Wrong number of posts", len(posts2.Order))
|
||||||
|
}
|
||||||
|
|
||||||
posts, resp = Client.SearchPosts(th.BasicTeam.Id, "search", false)
|
posts, resp = Client.SearchPosts(th.BasicTeam.Id, "search", false)
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
if len(posts.Order) != 3 {
|
if len(posts.Order) != 3 {
|
||||||
|
|||||||
@@ -726,6 +726,11 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr
|
|||||||
return nil, model.NewAppError("SearchPostsInTeam", "store.sql_post.search.disabled", nil, fmt.Sprintf("teamId=%v userId=%v", teamId, userId), http.StatusNotImplemented)
|
return nil, model.NewAppError("SearchPostsInTeam", "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
|
||||||
|
}
|
||||||
|
|
||||||
channels := []store.StoreChannel{}
|
channels := []store.StoreChannel{}
|
||||||
|
|
||||||
for _, params := range paramsList {
|
for _, params := range paramsList {
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user