Skip to main content

note_fts_document

Function note_fts_document 

Source
pub fn note_fts_document(note: &Note) -> TextDocument
Expand description

Build the TextDocument for a note. This is the single source of truth for note FTS document shape; all write paths (create, update, reindex) must go through this function so recall parity is guaranteed. Changes here apply to every caller automatically.

Body rule: when the note has a name, prepend it to the content ("<name> <content>"). This matches the FTS index contract: title and body both contribute to ranking, and the name is the most salient signal.

updated_at is taken from the note’s own timestamp (not Utc::now()) so that backfill and reindex runs record the note’s actual mutation time rather than the reindex execution time.