Advanced search: operators, ranking, snippets, saved searches #20

Merged
jonasled merged 1 commit from feat/2-advanced-search into master 2026-11-24 10:31:52 +00:00
Owner

Closes #2 (the Web Worker index from the issue is not included, see below)

What

  • Operators (new lib/search.ts, pure and unit tested): word, "exact phrase", -excluded, title:, body:, tag: and notebook: (case-insensitive, * wildcards; notebook: also matches notes in sub-notebooks), type:todo|note, iscompleted:0|1, created: / updated: as 20260101, 2026-01-01 or relative -7d / -2w / -3m / -1y ("on or after"), any:1 for OR. Quoted text is always literal ("tag:work" is not an operator), unknown or half-typed operators (tag:) are ignored while typing, negation works on every operator.
  • Ranking: title hits above body hits, a title that starts with the term above one that merely contains it, body hit count capped; ties by newest. Queries with only operators keep the normal sort.
  • Snippets: the note list shows the passage around the first hit with the match highlighted instead of the note's first lines. Links/images are flattened in the snippet.
  • Saved searches: bookmark button in the search box -> name -> listed under "Saved searches" in the sidebar (click to run, trash icon to delete). They are a new synced item type search (title = name, body = query): small backend change (TypeSearch in ValidType), included in end-to-end encryption and the push order. Backend test: a search item syncs, unknown types are still refused.
  • Search help as the input's tooltip, README feature entry.
  • Still runs on the device over the decrypted notes, so it works offline and with E2EE.

Tests

pnpm test (72; 12 new covering parsing, every operator, negation, any:1, wildcards + parent notebooks, dates absolute/relative/invalid, ranking, snippets), tsc, pnpm build, go test ./....

Not included

  • The inverted index in a Web Worker: search is a linear scan (marked shortcut: in search.ts). Fast for thousands of notes; add the index when someone has far more. The tag/notebook lookup tables are cached per items snapshot.
  • Search inside attachments, fuzzy matching, a "search help" dialog beyond the tooltip.
  • Not tried in a browser by me; only the unit tests and the build.
Closes #2 (the Web Worker index from the issue is not included, see below) ## What - **Operators** (new `lib/search.ts`, pure and unit tested): `word`, `"exact phrase"`, `-excluded`, `title:`, `body:`, `tag:` and `notebook:` (case-insensitive, `*` wildcards; `notebook:` also matches notes in sub-notebooks), `type:todo|note`, `iscompleted:0|1`, `created:` / `updated:` as `20260101`, `2026-01-01` or relative `-7d` / `-2w` / `-3m` / `-1y` ("on or after"), `any:1` for OR. Quoted text is always literal (`"tag:work"` is not an operator), unknown or half-typed operators (`tag:`) are ignored while typing, negation works on every operator. - **Ranking**: title hits above body hits, a title that starts with the term above one that merely contains it, body hit count capped; ties by newest. Queries with only operators keep the normal sort. - **Snippets**: the note list shows the passage around the first hit with the match highlighted instead of the note's first lines. Links/images are flattened in the snippet. - **Saved searches**: bookmark button in the search box -> name -> listed under "Saved searches" in the sidebar (click to run, trash icon to delete). They are a new synced item type `search` (title = name, body = query): small backend change (`TypeSearch` in `ValidType`), included in end-to-end encryption and the push order. Backend test: a `search` item syncs, unknown types are still refused. - Search help as the input's tooltip, README feature entry. - Still runs on the device over the decrypted notes, so it works offline and with E2EE. ## Tests `pnpm test` (72; 12 new covering parsing, every operator, negation, any:1, wildcards + parent notebooks, dates absolute/relative/invalid, ranking, snippets), `tsc`, `pnpm build`, `go test ./...`. ## Not included - The **inverted index in a Web Worker**: search is a linear scan (marked `shortcut:` in `search.ts`). Fast for thousands of notes; add the index when someone has far more. The tag/notebook lookup tables are cached per items snapshot. - Search inside attachments, fuzzy matching, a "search help" dialog beyond the tooltip. - Not tried in a browser by me; only the unit tests and the build.
feat(app): advanced search with operators, ranking, snippets and saved searches
All checks were successful
ci / frontend-tests (push) Successful in 57s
ci / backend-tests (push) Successful in 2m26s
ci / aur-src (push) Has been skipped
ci / build-1 (push) Successful in 2m1s
ci / frontend-docker (push) Successful in 0s
ci / server-binary (amd64, linux) (push) Successful in 2m44s
ci / server-binary (arm64, linux) (push) Successful in 2m46s
ci / server-binary (amd64, windows) (push) Successful in 2m47s
ci / build (push) Successful in 4m35s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / app-windows (push) Successful in 6m44s
ci / app-linux (push) Successful in 11m37s
ci / app-android (push) Successful in 14m18s
ci / release (push) Has been skipped
ci / aur-bin (push) Has been skipped
411e7a212e
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge master into feat/2-advanced-search
All checks were successful
ci / backend-tests (push) Successful in 57s
ci / frontend-tests (push) Successful in 33s
ci / aur-src (push) Has been skipped
ci / frontend-docker (push) Successful in 0s
ci / app-linux (push) Successful in 5m30s
ci / app-android (push) Successful in 7m37s
ci / build-1 (push) Successful in 1m14s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / app-windows (push) Successful in 4m8s
ci / server-binary (amd64, windows) (push) Successful in 1m46s
ci / build (push) Successful in 2m11s
ci / server-binary (arm64, linux) (push) Successful in 2m13s
ci / server-binary (amd64, linux) (push) Successful in 2m15s
ci / release (push) Has been skipped
ci / aur-bin (push) Has been skipped
6172717a60
jonasled force-pushed feat/2-advanced-search from 6172717a60
All checks were successful
ci / backend-tests (push) Successful in 57s
ci / frontend-tests (push) Successful in 33s
ci / aur-src (push) Has been skipped
ci / frontend-docker (push) Successful in 0s
ci / app-linux (push) Successful in 5m30s
ci / app-android (push) Successful in 7m37s
ci / build-1 (push) Successful in 1m14s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / app-windows (push) Successful in 4m8s
ci / server-binary (amd64, windows) (push) Successful in 1m46s
ci / build (push) Successful in 2m11s
ci / server-binary (arm64, linux) (push) Successful in 2m13s
ci / server-binary (amd64, linux) (push) Successful in 2m15s
ci / release (push) Has been skipped
ci / aur-bin (push) Has been skipped
to 58cb7c4d9d
All checks were successful
ci / frontend-tests (push) Successful in 57s
ci / backend-tests (push) Successful in 1m37s
ci / aur-src (push) Has been skipped
ci / build-1 (push) Successful in 1m42s
ci / frontend-docker (push) Successful in 0s
ci / app-linux (push) Successful in 5m58s
ci / build (push) Successful in 5m47s
ci / app-windows (push) Successful in 5m3s
ci / server-binary (arm64, linux) (push) Successful in 4m31s
ci / server-binary (amd64, windows) (push) Successful in 4m25s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / server-binary (amd64, linux) (push) Successful in 4m31s
ci / release (push) Has been skipped
ci / app-android (push) Successful in 8m49s
ci / aur-bin (push) Has been skipped
2026-11-24 07:38:27 +00:00
Compare
jonasled force-pushed feat/2-advanced-search from 58cb7c4d9d
All checks were successful
ci / frontend-tests (push) Successful in 57s
ci / backend-tests (push) Successful in 1m37s
ci / aur-src (push) Has been skipped
ci / build-1 (push) Successful in 1m42s
ci / frontend-docker (push) Successful in 0s
ci / app-linux (push) Successful in 5m58s
ci / build (push) Successful in 5m47s
ci / app-windows (push) Successful in 5m3s
ci / server-binary (arm64, linux) (push) Successful in 4m31s
ci / server-binary (amd64, windows) (push) Successful in 4m25s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / server-binary (amd64, linux) (push) Successful in 4m31s
ci / release (push) Has been skipped
ci / app-android (push) Successful in 8m49s
ci / aur-bin (push) Has been skipped
to 7b0e9edf3e
All checks were successful
ci / frontend-docker (push) Successful in 0s
ci / build-1 (push) Successful in 41s
ci / frontend-tests (push) Successful in 35s
ci / aur-src (push) Has been skipped
ci / backend-tests (push) Successful in 1m33s
ci / server-binary (amd64, windows) (push) Successful in 1m52s
ci / server-binary (arm64, linux) (push) Successful in 1m54s
ci / build (push) Successful in 2m15s
ci / app-android (push) Successful in 10m2s
ci / server-binary (amd64, linux) (push) Successful in 1m50s
ci / backend-docker (push) Successful in 0s
ci / build-2 (push) Has been skipped
ci / chart (push) Successful in 0s
ci / app-windows (push) Successful in 4m2s
ci / release (push) Has been skipped
ci / aur-bin (push) Has been skipped
ci / app-linux (push) Successful in 5m46s
2026-11-24 07:56:40 +00:00
Compare
jonasled merged commit 1bce1b0074 into master 2026-11-24 10:31:52 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jonasled/notes!20
No description provided.