Tearleads

document_projection_text Client SQLite table

Projected document text, split from documentProjection so content size never bloats the rows that list/window queries scan. Loaded only by detail reads (loadDocument) and the save-timestamp change check.

Declared in packages/client-sdk/src/data/sqlite/schema/documentProjectionSchema.ts

Columns

  • local_idtext
    • primary key
    • nullable

    Stable local document id, matching documentProjection.localId.

  • texttext
    • not null

    Plain projected text used to rebuild summaries/details.

  • attachment_namestext
    • nullable

    JSON object with one entry per attachment the document content records, keyed <contentSha256>:<slotId>, whose value holds the file name and its lower-cased search form. Null until the names are first projected; a backfill fills null rows.

Indexes

  • document_projection_text_missing_names_idx(local_id)
    • partial: where "attachment_names" IS NULL

    Only documents awaiting their first filename projection need backfill.

DDL

The statements the client runs to create this table and its indexes.

CREATE TABLE IF NOT EXISTS "document_projection_text" (
  "local_id" TEXT PRIMARY KEY,
  "text" TEXT NOT NULL,
  "attachment_names" TEXT
);

CREATE INDEX IF NOT EXISTS "document_projection_text_missing_names_idx" ON "document_projection_text" ("local_id") WHERE "attachment_names" IS NULL;