fix: bg purport reseed

This commit is contained in:
Krispire Admin
2026-06-23 15:01:03 +05:30
parent 96ebbfd719
commit 44a0016513
+10 -4
View File
@@ -307,11 +307,17 @@ func indexVerses(sugar *zap.SugaredLogger, tsClient *typesense.Client, mongoDB *
TokenSeparators: &hyphenSeparators,
}
_, err := tsClient.Collections().Create(context.Background(), schema)
if err != nil {
sugar.Fatalf("[verses] Failed to create collection: %v", err)
// Create the collection; tolerate "already exists" so a --no-drop run can
// upsert into the live collection without dropping it (matches indexProse).
if _, err := tsClient.Collections().Create(context.Background(), schema); err != nil {
if strings.Contains(err.Error(), "already exists") {
sugar.Warnf("[verses] Create collection: %v (continuing — upserting into existing)", err)
} else {
sugar.Fatalf("[verses] Failed to create collection: %v", err)
}
} else {
sugar.Info("[verses] Collection created")
}
sugar.Info("[verses] Collection created")
// Read from MongoDB
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)