fix: bg purport reseed
This commit is contained in:
+8
-2
@@ -307,11 +307,17 @@ func indexVerses(sugar *zap.SugaredLogger, tsClient *typesense.Client, mongoDB *
|
|||||||
TokenSeparators: &hyphenSeparators,
|
TokenSeparators: &hyphenSeparators,
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err := tsClient.Collections().Create(context.Background(), schema)
|
// Create the collection; tolerate "already exists" so a --no-drop run can
|
||||||
if err != nil {
|
// 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)
|
sugar.Fatalf("[verses] Failed to create collection: %v", err)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
sugar.Info("[verses] Collection created")
|
sugar.Info("[verses] Collection created")
|
||||||
|
}
|
||||||
|
|
||||||
// Read from MongoDB
|
// Read from MongoDB
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
|
||||||
|
|||||||
Reference in New Issue
Block a user