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: fall back to publication by DID when document has no publication_uri

Some looseleaf documents don't have a publication field, but the user
has a publication. Fall back to finding a publication by DID to get
the base_path for URL building.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

zzstoatzz f05dd8d7 a32970e6

+8 -4
+8 -4
backend/src/search.zig
··· 65 65 66 66 const DocsByTag = zql.Query( 67 67 \\SELECT d.uri, d.did, d.title, '' as snippet, 68 - \\ d.created_at, d.rkey, COALESCE(p.base_path, '') as base_path, 68 + \\ d.created_at, d.rkey, 69 + \\ COALESCE(p.base_path, (SELECT base_path FROM publications WHERE did = d.did LIMIT 1), '') as base_path, 69 70 \\ CASE WHEN d.publication_uri != '' THEN 1 ELSE 0 END as has_publication, 70 71 \\ d.platform, COALESCE(d.path, '') as path 71 72 \\FROM documents d ··· 78 79 const DocsByFtsAndTag = zql.Query( 79 80 \\SELECT f.uri, d.did, d.title, 80 81 \\ snippet(documents_fts, 2, '', '', '...', 32) as snippet, 81 - \\ d.created_at, d.rkey, COALESCE(p.base_path, '') as base_path, 82 + \\ d.created_at, d.rkey, 83 + \\ COALESCE(p.base_path, (SELECT base_path FROM publications WHERE did = d.did LIMIT 1), '') as base_path, 82 84 \\ CASE WHEN d.publication_uri != '' THEN 1 ELSE 0 END as has_publication, 83 85 \\ d.platform, COALESCE(d.path, '') as path 84 86 \\FROM documents_fts f ··· 92 94 const DocsByFts = zql.Query( 93 95 \\SELECT f.uri, d.did, d.title, 94 96 \\ snippet(documents_fts, 2, '', '', '...', 32) as snippet, 95 - \\ d.created_at, d.rkey, COALESCE(p.base_path, '') as base_path, 97 + \\ d.created_at, d.rkey, 98 + \\ COALESCE(p.base_path, (SELECT base_path FROM publications WHERE did = d.did LIMIT 1), '') as base_path, 96 99 \\ CASE WHEN d.publication_uri != '' THEN 1 ELSE 0 END as has_publication, 97 100 \\ d.platform, COALESCE(d.path, '') as path 98 101 \\FROM documents_fts f ··· 228 231 // brute-force cosine similarity search (no vector index needed) 229 232 var res = c.query( 230 233 \\SELECT d2.uri, d2.did, d2.title, '' as snippet, 231 - \\ d2.created_at, d2.rkey, COALESCE(p.base_path, '') as base_path, 234 + \\ d2.created_at, d2.rkey, 235 + \\ COALESCE(p.base_path, (SELECT base_path FROM publications WHERE did = d2.did LIMIT 1), '') as base_path, 232 236 \\ CASE WHEN d2.publication_uri != '' THEN 1 ELSE 0 END as has_publication, 233 237 \\ d2.platform, COALESCE(d2.path, '') as path 234 238 \\FROM documents d1, documents d2