feat(search): align message result payloads

This commit is contained in:
2026-06-07 09:13:03 +08:00
parent e99330a06f
commit 626a1f7a29
9 changed files with 388 additions and 68 deletions
+4 -1
View File
@@ -173,7 +173,10 @@ func reindexMessages(ctx context.Context, engine search.SearchEngine, db *gorm.D
var lastID uint
for {
var rows []model.Message
q := db.WithContext(ctx).Where("id > ?", lastID).Order("id ASC").Limit(batchSize)
q := db.WithContext(ctx).
Preload("Conversation").
Preload("Attachments", func(db *gorm.DB) *gorm.DB { return db.Order("id ASC") }).
Where("id > ?", lastID).Order("id ASC").Limit(batchSize)
if accountID != 0 {
q = q.Where("account_id = ?", accountID)
}