Skip to content

Commit 66cb530

Browse files
committed
enable search index compression
1 parent 104fb93 commit 66cb530

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/UnidocDB/Unidoc.DB.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,11 @@ extension Unidoc.DB
458458
clear:Bool = true,
459459
with session:Mongo.Session) async throws -> Unidoc.SitemapDelta?
460460
{
461+
// We assume compressing the search JSON will take a (relatively) long time, so we do
462+
// it before performing any database operations.
463+
let search:Unidoc.TextResource<Symbol.Edition> = .init(id: volume.id,
464+
text: .init(compressing: volume.index.utf8))
465+
461466
if clear
462467
{
463468
try await self.vertices.clear(range: volume.edition, with: session)
@@ -476,7 +481,7 @@ extension Unidoc.DB
476481
}
477482

478483
try await self.volumes.insert(some: volume.metadata, with: session)
479-
try await self.search.insert(some: volume.search, with: session)
484+
try await self.search.insert(some: search, with: session)
480485
try await self.trees.insert(some: volume.trees, with: session)
481486

482487
try await self.vertices.insert(volume.vertices, with: session)

0 commit comments

Comments
 (0)