fix: search fix for magazines and other docs
This commit is contained in:
+8
-3
@@ -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 ====================
|
||||
|
||||
Reference in New Issue
Block a user