Commit a8d116b3 authored by Christopher Speller's avatar Christopher Speller Committed by Carlos Tadeu Panato Junior
Browse files

Speed up search results post selection. (#9380)

parent bb605a6b
......@@ -705,8 +705,10 @@ func (a *App) SearchPostsInTeam(terms string, userId string, teamId string, isOr
return nil, presult.Err
} else {
for _, p := range presult.Data.([]*model.Post) {
postList.AddPost(p)
postList.AddOrder(p.Id)
if p.DeleteAt == 0 {
postList.AddPost(p)
postList.AddOrder(p.Id)
}
}
}
}
......
......@@ -1156,7 +1156,7 @@ func (s *SqlPostStore) GetPostsByIds(postIds []string) store.StoreChannel {
params[key] = postId
}
query := `SELECT * FROM Posts WHERE Id in (` + keys.String() + `) and DeleteAt = 0 ORDER BY CreateAt DESC`
query := `SELECT * FROM Posts WHERE Id in (` + keys.String() + `) ORDER BY CreateAt DESC`
var posts []*model.Post
_, err := s.GetReplica().Select(&posts, query, params)
......
......@@ -1674,8 +1674,8 @@ func testPostStoreGetPostsByIds(t *testing.T, ss store.Store) {
store.Must(ss.Post().Delete(ro1.Id, model.GetMillis(), ""))
if ro5 := store.Must(ss.Post().GetPostsByIds(postIds)).([]*model.Post); len(ro5) != 2 {
t.Fatalf("Expected 2 posts in results. Got %v", len(ro5))
if ro5 := store.Must(ss.Post().GetPostsByIds(postIds)).([]*model.Post); len(ro5) != 3 {
t.Fatalf("Expected 3 posts in results. Got %v", len(ro5))
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment