fix: search fix for magazines and other docs

This commit is contained in:
Krispire Admin
2026-05-10 23:22:37 +05:30
parent e3f14ef8ba
commit 00b862f77e
2 changed files with 20 additions and 3 deletions
+8 -3
View File
@@ -107,10 +107,13 @@ func main() {
}
defer mongoDB.Close()
// Create Typesense client
// Create Typesense client.
// Default connection timeout is 5s — too short for large content imports
// (magazines and other_documents can ship multi-MB batches).
tsClient := typesense.NewClient(
typesense.WithServer(cfg.TypesenseURL),
typesense.WithAPIKey(cfg.TypesenseAPIKey),
typesense.WithConnectionTimeout(5*time.Minute),
)
// Determine which collections to index
@@ -909,7 +912,8 @@ func indexMagazines(sugar *zap.SugaredLogger, tsClient *typesense.Client, mongoD
}
sugar.Infof("[magazines] Read %d documents from MongoDB", len(docs))
importBatch(sugar, tsClient, "magazines", docs, 500)
// Smaller batch size: each magazine issue can have very large paragraphs
importBatch(sugar, tsClient, "magazines", docs, 25)
}
// ==================== OTHER DOCUMENTS ====================
@@ -983,7 +987,8 @@ func indexOtherDocuments(sugar *zap.SugaredLogger, tsClient *typesense.Client, m
}
sugar.Infof("[other_documents] Read %d documents from MongoDB", len(docs))
importBatch(sugar, tsClient, "other_documents", docs, 500)
// Smaller batch size: each chapter can have very large paragraphs
importBatch(sugar, tsClient, "other_documents", docs, 25)
}
// ==================== HELPERS ====================