Skip to content
Documentation GitHub
Navigation

Search

Search

Search is provided via the command palette’s query input. Typing into the palette searches page titles and body content simultaneously. Results include a content snippet showing matched context. Title matches appear under a “Pages” section header; body-content matches appear under “Content matches”. An empty or whitespace-only query shows a prompt rather than results. Special characters in queries are handled gracefully without producing errors.

Preconditions

  • Workspace is open and the sidebar is visible
  • Seed workspace contains pages designed to test each scenario:
    • fts-title-page: a page whose title contains the token “Veridian”
    • fts-content-page: a page whose title is “Unrelated Heading” but whose body contains the phrase “chromatic resonance”
    • fts-both-page: a page whose title and body both contain the token “praxis”
    • fts-special-chars-page: a page titled “Ampersand & Apostrophe’s” with body “cost is £42 (approx)”
    • At least 51 pages in total (for the result-limit scenario) — these can be minimal pages with only a title

Scenarios

Seed: seed.spec.ts

1. Full-text search by title returns the matching page

A query matching a unique word in a page title returns that page in the “Pages” section of the command palette.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “Veridian” in the search input

Expected: The “Pages” results section appears in the dropdown. At least one result item shows a title containing “Veridian”. The “Content matches” section may or may not appear depending on whether “Veridian” also appears in any page body.

2. Full-text search by body content returns the matching page

A query matching a phrase that exists only in a page’s body (not its title) returns that page in the “Content matches” section, not the “Pages” section.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “chromatic resonance” in the search input

Expected: The “Content matches” section appears with at least one result item. The result’s title reads “Unrelated Heading” (the phrase itself is not in any page title). The “Pages” section either does not appear or does not contain “Unrelated Heading”. This confirms the hit was a body match.

3. Search result includes a content snippet

Results in the “Content matches” section display a snippet of the matched body text providing context around the match.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “chromatic resonance”
  3. Observe the result item for “Unrelated Heading” in the “Content matches” section

Expected: The result item displays a snippet of text beneath or alongside the page title. The snippet contains text from the page body near the match location. The snippet is non-empty and is not the same string as the page title.

4. Query matching both title and body surfaces results in both sections

A token present in both a page title and a different page’s body content yields entries under both “Pages” and “Content matches” simultaneously.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “praxis”

Expected: The “Pages” section contains a result whose title includes “praxis”. The “Content matches” section contains a separate result where “praxis” appears in the body. Both sections are visible at the same time in the results list.

5. No-matches empty state

Typing a query that matches nothing in the workspace displays an appropriate empty-state message.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “zzz_absolutely_no_match_xyz_999_unique”

Expected: The results area shows “No results found”. No section headers (“Pages”, “Content matches”, “Actions”) appear. The input is not cleared. No error toast is visible.

6. Empty query shows prompt, not search results

Clearing the query after typing (back to empty string) transitions the results area from results back to the prompt state.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “Veridian” to get results
  3. Clear the input (select all + Delete, or backspace to empty)

Expected: The “Pages” section disappears. The results area shows “Start typing to search…” rather than an empty section list. No error appears.

7. Whitespace-only query produces no results

A query composed only of spaces is treated as an empty query and returns nothing.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type three spaces ” ”

Expected: The results area shows the prompt state (“Start typing to search…”) or “No results found”. No result section headers are displayed. No crash or visible error occurs.

8. Special characters in query are handled gracefully

Queries containing punctuation or characters that could affect search syntax do not produce errors and either return matches or the empty state.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “Ampersand & Apostrophe’s”
  3. Observe the results area

Expected: The command palette either returns the “Ampersand & Apostrophe’s” page as a result, or shows “No results found”. No error toast, no unhandled exception, and no crash. The UI remains functional and the input remains editable.

9. Search with pound sign and parentheses does not crash

Queries containing £, (, ) characters are handled without error.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “£42”

Expected: The command palette either returns a result for the page whose body contains “cost is £42 (approx)”, or shows “No results found”. No error toast. No crash. The palette remains open and interactive.

10. Result count is capped — UI renders without overflow

A broad single-character query that matches many pages renders all returned results without layout overflow or performance freeze.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “a” (a single character expected to match many pages)

Expected: The results list renders completely. Scrolling through the results is smooth. The combined item count across all sections does not cause the palette to extend beyond the viewport or produce a frozen UI.

11. Selecting a search result navigates to the correct page

After searching, selecting a “Content matches” result navigates to the correct page and loads its content in the editor.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “chromatic resonance”
  3. Click the result item for “Unrelated Heading” under “Content matches”

Expected: The command palette closes. The editor displays “Unrelated Heading” as the active page. The body content of that page is visible and contains “chromatic resonance”. The sidebar tree item for “Unrelated Heading” is aria-selected="true".

12. Search results update as query is refined

Each keystroke that changes the query causes the results to update, reflecting the narrower or broader match set.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “p” — note the number of results
  3. Type “pr” — note the number of results
  4. Type “pra” — note the number of results
  5. Type “praxis” — observe final results

Expected: Each additional character refines the result set. The result list updates reactively after each keystroke. After typing “praxis”, only pages containing that token are shown. No stale results from a previous query persist after a new one is issued.

13. FTS5 partial-word prefix matching

Typing the beginning of a word returns pages whose content starts with that prefix.

Steps:

  1. Press Cmd+K to open the command palette
  2. Type “chrom” (a prefix of “chromatic”)

Expected: The “Content matches” section includes the page containing “chromatic resonance”. The match is returned even though the full word was not typed.

Test Data

KeyValueNotes
title_only_tokenVeridianExists only in title of fts-title-page
body_only_phrasechromatic resonanceExists only in body of fts-content-page
both_tokenpraxisExists in title of one page and body of another
special_chars_titleAmpersand & Apostrophe’sPage title with punctuation
special_chars_body_token£42Token from page body with non-ASCII char
no_match_queryzzz_absolutely_no_match_xyz_999_uniqueGuaranteed absent from workspace
prefix_tokenchromPrefix of “chromatic” for prefix match test
broad_single_charaIntended to match many pages for render-limit test

Notes

  • A whitespace-only query is trimmed client-side; the results area should transition to the prompt state without issuing a search
  • Section headers “Pages”, “Content matches”, and “Actions” are rendered only when each result array is non-empty
  • FTS5 with unicode61 tokenizer treats &, ', (, ), £ as token separators, so “Ampersand & Apostrophe’s” tokenizes to individual words — searches for the full phrase may not match as a contiguous phrase query; the spec only requires no error and a valid empty-state response
  • Snippets may include highlight markers (e.g., <b>...</b>) depending on implementation — the spec only requires the snippet text is non-empty and visually distinct from the title
  • A brief “Searching content…” loading indicator may appear; wait for it to clear before asserting final result state
  • Semantic search results are out of scope for this spec; only FTS title and body matching is covered here

Was this page helpful?