mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Speed up search results post selection. (#9380)
This commit is contained in:
committed by
Carlos Tadeu Panato Junior
parent
bb605a6b91
commit
a8d116b381
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user