Home · Docs · Libraries · Search

Search

Cross-library full-text search over document titles, content, and folder names. Powered by Postgres tsvector columns + websearch query syntax. Debounced and capped.

Search in sweetdocs runs against the database’s full-text index, cross-library, and returns matches across every document and folder you have access to.

There are two surfaces:

SurfaceBest for
Command palette (⌘K)Open or jump to a specific doc by title; recent documents are surfaced first
Dedicated search input (sidebar / search panel)Free-text queries with snippets and content matches

The command palette covers fast “I know what I want” jumps; the dedicated search covers exploratory queries.

How matching works

Search is backed by Postgres tsvector columns:

Queries use Postgres websearch_to_tsquery, which understands a small natural syntax:

You typeMeans
auth migrationBoth words must appear (implicit AND)
"auth migration"Exact phrase match
auth OR migrationEither word
auth -migrationDocuments matching “auth” but not “migration”
migration:*Prefix match (any word starting with “migration”)

These are real Postgres semantics — what websearch_to_tsquery understands is what works here.

Scope

Search reads across every library you have access to, including:

Results show the library name next to each match so you know where the doc lives.

What’s returned

For each result:

FieldSource
Title (docs) / Name (folders)From the row
Library name”My Documents” for the personal library, the org library name otherwise
Snippet (~120 chars)Computed client-side from the document content, centered on the match
Doc-type iconMarkdown / SVG / table / etc. — folders use the folder icon
Updated timeFor documents

Snippets are computed client-side because supabase-js doesn’t expose Postgres’s native ts_headline snippet function. The 120-char window is a fixed slice around the first match in the content.

Performance details

What’s not in v1

MissingNotes
Filters in the query syntax (e.g., in:Recipes, is:pinned)Not parsed in v1 — use the sidebar’s folder tree for scoping
Search inside commentsComments have their own panel and aren’t indexed
Search inside images (OCR)Not in v1
Search inside file attachmentsNot in v1
Saved searchesNot in v1
Result-quality controls (e.g., “match in title only”)Not in v1
Search inside the recycling binExcluded — restore first, then search

Search results respect the same RLS policies as everything else in sweetdocs. The query runs as your user; the database filters out rows you can’t read. There’s no separate “search permission” — if you can open the doc, search can find it; if you can’t, it doesn’t.