search for standard sites pub-search.waow.tech
search zig blog atproto
11
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: backfill base_path when publication arrives after document

when a document arrives on the firehose before its publication,
it gets indexed with an empty base_path. this adds a reactive
backfill in insertPublication() that patches any such documents,
bumps indexed_at for sync, and clears embedded_at for re-embedding.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz ef1cfe15 691dfebe

+16
+16
backend/src/ingest/indexer.zig
··· 244 244 &.{ uri, did, rkey, name, description orelse "", base_path orelse "" }, 245 245 ); 246 246 247 + // backfill: if documents arrived before this publication, they have empty base_path 248 + if (base_path) |bp| { 249 + if (bp.len > 0) { 250 + c.exec( 251 + \\UPDATE documents SET 252 + \\ base_path = ?, 253 + \\ indexed_at = strftime('%Y-%m-%dT%H:%M:%S', 'now'), 254 + \\ embedded_at = NULL 255 + \\WHERE publication_uri = ? 256 + \\ AND (base_path IS NULL OR base_path = '') 257 + , &.{ bp, uri }) catch |err| { 258 + logfire.warn("indexer: base_path backfill failed for pub {s}: {}", .{ uri, err }); 259 + }; 260 + } 261 + } 262 + 247 263 // update FTS index (includes base_path for subdomain search) 248 264 c.exec("DELETE FROM publications_fts WHERE uri = ?", &.{uri}) catch {}; 249 265 c.exec(