Skip to main content

LIVE_LEAF_SQL

Constant LIVE_LEAF_SQL 

Source
pub const LIVE_LEAF_SQL: &str = "b.deleted_commit IS NULL AND NOT EXISTS (SELECT 1 FROM blocks c WHERE c.doc_id = b.doc_id AND c.parent_block = b.block_id AND c.deleted_commit IS NULL)";
Expand description

SQL predicate: the blocks row aliased b is a live leaf — no live row of the same document names it as parent_block (search 1.2: a container’s text is its children’s text joined, so only leaves are indexed). c.doc_id = b.doc_id lets the subquery use idx_blocks_doc.