Neat idea but you could build this with a fraction of the complexity by ditching sqlite and duckdb for your native file system and rg/grep/gawk with equivalent performance
on the other hand in supmua (which inspired notmuch) the same search takes seconds.