Introducing a new way to review your PRs.

Read the announcement

triliumnext / trilium

Build your personal knowledge base with Trilium Notes

View on GitHub

20 documents · Updated Nov 23, 2026

docs / client-search-and-visual-tools

Client search and visual tools

The client helps people find notes, see links between them, understand storage use, and inspect rich content. Search results now load page details on demand and can expand from an excerpt to the full note. Visual tools include collection views, relation maps, space usage, mind maps, and viewers for files and media. See Client experience for the client shell, Client note editing and navigation for note selection and editor behavior, and Client settings and session security for settings and session boundaries.

Search surfaces

Search turns a query into a result view that users can inspect and reuse. Quick search supports fast lookup. Full search and collection search support paging, snippets, highlighting, and actions.

Quick search sends the query to the server and shows note paths and snippets while the user types. It marks matching text when the user opens a result and can pass the query to full search. Its scope follows the current note area and excludes archived notes unless the current context permits them. Errors stay visible instead of looking like an empty result.

References: apps/…/quick_search.tsx• L75-104 apps/…/quick_search.tsx• L208-279

Full search makes a query a first-class note view. Its result cards show the live title and icon as soon as they are known. The client then loads snippets, paths, matched terms, and attribute details for the visible page. This keeps the result surface quick while still giving each card the context needed for review.

Each card links only its title to the note. When the matched content is longer than the excerpt, the card can expand to the full note without leaving the result view. The link carries the terms that the note matched, so the opened note can show the same search context. A protected note can show that its snippet is unavailable instead of showing a false empty match.

The result view shows the total count, a page-size choice, and paging controls. A new search starts at the first page. Details load again when the search runs, even when the result IDs do not change, and an older request cannot replace details for a newer page.

This diagram shows how a search result page becomes a set of reviewable cards.

flowchart LR
    A[Search note] --> B[Matching note IDs]
    B --> C[Visible result page]
    C --> D[Lazy snippets and attributes]
    D --> E[Result cards]
    E --> F[Open with matched terms]
    E --> G[Expand to note content]

References: apps/…/SearchResultsList.tsx• L25-79 apps/…/useSearchResultDetails.ts• L13-71 apps/…/SearchResultCard.tsx• L27-45 apps/…/SearchResultCard.tsx• L85-137

Search definition

The search definition surface turns a search note into a repeatable query and action. It keeps query settings and bulk actions with the search note, so the definition travels with the result view. Users can add or remove settings from one menu, then refresh results, run actions, or save a hidden search as a normal note.

The available settings cover the query text, script, note scope, archive inclusion, sort order, result limit, and search mode. A pending query edit is saved before a search or action runs. Invalid query text stays visible with a caution message.

References: apps/…/SearchDefinition.tsx• L29-207 apps/…/SearchDefinitionOptions.tsx• L22-245 apps/…/SearchDefinition.css• L1-150

Collection filtering

Collection filtering narrows the notes already shown by a collection without changing their order. The user submits a full-search query with Enter or a search button. Clear and Escape keep typed text separate from the query that is active in the collection. The saved query returns when the collection opens.

The filter keeps the last valid matches when a query is invalid and accepts only the newest search run. Changes inside the collection schedule one new search after a short delay. A newly created note stays visible until the query changes.

References: apps/…/collection_filter.tsx• L48-287 apps/…/collection_filter.css• L1-151

Settings search finds options across the settings pages rather than notes. It waits briefly after typing, then groups matching options under their page names. This gives settings one search entry point without changing note search.

References: apps/…/search_page.tsx• L41-121

Note tree navigation

The note tree is the client’s persistent hierarchy surface for opening notes, reviewing saved-search results, and changing note placement. Saved searches load their result branches on demand. The tree keeps selection, expansion, archived-note visibility, and clone paths tied to the current note context.

When a note moves into a parent with clones, the tree keeps the parent path chosen by the user. This keeps the open tab and the tree on the same copy of the note. A moved note in a hidden subtree remains visible through the selected parent context.

References: apps/…/note_tree.ts• L464-580 apps/…/note_tree.ts• L923-1040 apps/…/note_tree.ts• L1278-1469 apps/…/branches.ts• L76-120

Collection views

Collection views give a group of notes a visual form for sorting, comparison, planning, presentation, or place-based browsing. They keep the normal note model while adding a view-specific way to inspect and change the group. Each view restores its own saved settings.

Board view

The board view turns notes into cards grouped by a field, label, or relation. It supports creating notes, moving cards, changing groups, editing columns, filtering, and applying actions to several cards. The note tree remains the source of the cards.

Columns combine saved choices with values still used by notes. This keeps cards visible when a value is no longer offered by the current field definition. Collapse, sort, limits, archive rules, templates, and promoted fields shape the view without changing the notes themselves. Stable card and column links can reveal content inside a collapsed or windowed board.

This diagram shows how a collection becomes an editable board.

flowchart LR
    A[Collection note] --> B[Grouping field or relation]
    B --> C[Resolved columns]
    C --> D[Cards from notes]
    D --> E[Filter and saved layout]
    E --> F[Visible board]
    F --> G[Card or column action]
    G --> H[Saved note or view change]

References: apps/…/NoteList.tsx• L38-65 apps/…/index.tsx• L350-385 apps/…/index.tsx• L520-745 apps/…/reference.ts• L65-169

Table view

The table view presents a note group as editable rows and attribute columns. It uses note identity for rows while showing titles, labels, dates, links, and relations as cells. Edits write back to the note model, so the table is an alternate editing surface rather than a copy of note data.

The view keeps row updates separate from column updates. This lets a cell remain open while its value changes. Typed fields, relation titles, multi-value fields, and localized dates keep their visible, stored, and sort forms aligned.

References: apps/…/data.tsx• L12-115 apps/…/row_editing.ts• L22-119 apps/…/columns.tsx• L142-215

Dashboard view

The dashboard view arranges child notes as movable widgets on one surface. Each widget keeps the note’s title and content while the dashboard stores its position and size. This lets one dashboard combine different note types without copying their content.

Drag-and-drop adds notes from the tree. A narrow surface derives a one-column layout without replacing the wider saved layout. Widgets can refresh when their content needs a new render.

References: apps/…/index.tsx• L24-65 apps/…/index.tsx• L85-176 apps/…/index.tsx• L194-365

Geographic map

The geographic map places notes, tracks, and drawn shapes on a map. It searches map content, nearby places, named base-map places, and typed coordinates. An outside place is temporary until the user saves it as a note marker.

The map can create and move markers, import GPX tracks, and draw lines, polygons, rectangles, or circles. A finished shape becomes note content, so it remains searchable and editable. Selecting a feature opens note details or a temporary place panel and frames the map around the selected feature.

References: apps/…/index.tsx• L89-132 apps/…/SearchBox.tsx• L98-225 apps/…/DrawShape.tsx• L18-63 apps/…/DetailPane.tsx• L145-259

Relation maps

A relation map is a note surface for seeing and editing named links between notes. It combines note placements with current relation data. The layout belongs to the map note, while the links describe the notes shown on the map.

Map view

The map shows note boxes and labeled connections. A connection can be one-way, two-way, or an inverse pair when the note model defines matching relation names. Display settings control which relation types appear.

A note can be placed on the map without moving it in the normal tree. A note created from the map becomes a child of the map note and is then placed on the canvas.

This diagram shows how a map note becomes a visual relation view.

flowchart LR
    A[Map note] --> B[Stored note placements]
    B --> C[Displayed note boxes]
    C --> D[Current relation data]
    D --> E[Labeled connections]
    E --> F[Pan and zoom view]
    E --> G[Relation action]

References: apps/…/RelationMap.tsx• L50-179 apps/…/RelationMap.tsx• L250-373 apps/…/api.ts• L11-177 packages/…/relation-map.ts• L25-60

Map actions

Map actions change either the visual arrangement or the note relations. Users can drag notes into the map, add notes, connect notes with a relation name, and rename or remove a connection. Pan, zoom, and note positions are saved as map state. Read-only notes keep the view available but block edits.

References: apps/…/RelationMap.tsx• L106-179 apps/…/RelationMap.tsx• L335-448 apps/…/api.ts• L62-177

Space usage

Space usage explains where the note database uses storage and gives the user controlled ways to reclaim it. It offers a whole-space view and a note-by-note view. Both are on-demand readings, so refresh asks for new measurements.

Storage overview

The overview ranks visible notes by their content and attachments. A treemap gives large notes more area and groups other, hidden, revision, and deleted content into separate categories. Whole-space totals let the user read the chart as both a ranking and a database summary.

The server separates occupied data from reclaimable data. Shared content is counted without promising the same bytes more than once. This keeps cleanup estimates distinct from the amount of storage that exists.

References: apps/…/index.tsx• L30-166 apps/…/overview.tsx• L42-125 packages/…/space_usage.ts• L64-109

Storage browse view

The browse view explains one note at a time. The center ring shows the note’s own content and attachments. The outer ring shows storage held by child notes. Breadcrumbs and back navigation keep the note tree in view while the user moves through it.

The overview and browse view share note paths and refresh state. On touch devices, a first tap names a chart item and a later action opens its details. This replaces hover-based inspection.

References: apps/…/browse.tsx• L51-177 apps/…/index.tsx• L43-75 apps/…/selection.tsx• L12-37

Storage cleanup

The cleanup dialog turns measured reclaimable space into explicit choices. It can erase deleted data, remove unused attachments, reduce old revision snapshots, compress images, and compact the database where supported. It estimates the selected result before confirmation, reports progress, and refreshes the charts after the work.

Cleanup is destructive. Its estimate describes reclaimable space rather than a promise that each selected item owns a unique blob. Database compaction also needs temporary disk space while the old database remains.

References: apps/…/cleanup_dialog.tsx• L41-185 packages/…/space_usage.ts• L35-83

Visual content viewers

Visual viewers give each content type the controls that match its task while keeping note context available. Images support inspection. PDFs support document work. Audio and video support playback. Web views show remote pages in an isolated surface. Presentations turn child notes into slides. Mind maps show hierarchies and links. Canvases and drawings support visual composition.

Image viewer

The image viewer fits an image to the available area and supports zoom, pan, reset, keyboard control, and image-to-image navigation. It reports load failures instead of leaving an empty pane. The same viewer serves image notes and full-detail image attachments.

References: apps/…/ImageViewer.tsx• L64-79 apps/…/ImageViewer.tsx• L158-210 apps/…/Image.tsx• L18-55

Mind map viewer

The mind map viewer presents a hierarchy with labeled links, images, icons, and node notes. It supports editing when the note is writable and keeps a read-only map useful for inspection. Users can change layout direction, zoom, focus, center, and full-screen state. Selecting nodes opens a panel for node formatting, links, images, tags, and memos.

The map keeps a portable preview with the note. The same visual result supports previews, shared pages, included notes, and SVG or PNG export. The map also sanitizes stored node markup before it reaches the viewer, and it allows only safe links to remain active.

This diagram shows how a mind map becomes both an interactive view and a portable visual result.

flowchart LR
    A[Stored map data] --> B[Sanitized mind map]
    B --> C[Interactive map]
    C --> D[Node panel and map controls]
    C --> E[Portable SVG preview]
    E --> F[Shared page or included note]
    E --> G[SVG or PNG export]

References: apps/…/MindMap.tsx• L31-74 apps/…/MindMap.tsx• L92-162 apps/…/MapToolbar.tsx• L17-74 apps/…/NodePanel.tsx• L56-108 apps/…/NodeMemo.tsx• L17-52 apps/…/links.ts• L43-101

PDF viewer

The PDF viewer presents a document with page navigation, find, print, and optional editing. When the document supports them, the surrounding note interface also exposes its outline, pages, thumbnails, annotations, attachments, and layers. Edits and annotations return to the note as a new file state.

The document surface carries the active note and context identity into its frame. This keeps page state and saves tied to the correct open PDF.

References: apps/…/Pdf.tsx• L66-258 apps/…/PdfViewer.tsx• L17-110

Audio and video players

Audio and video viewers focus on playback without losing note navigation. They provide play, seek, volume, speed, sibling navigation, and media-specific controls. Lightweight previews wait to create a player until the user starts playback.

Only one mounted player plays at a time. Full-detail playback can keep its operating-system media session in the background. Unsupported media produces a clear error.

References: apps/…/MediaPreview.tsx• L25-55 apps/…/MediaPlayer.tsx• L98-458 apps/…/MediaPlayer.tsx• L527-584 apps/…/Video.tsx• L74-137 apps/…/Audio.tsx• L46-70

Embedded web view

The web view lets a note display a remote page inside the note workspace. A valid URL enables the view. A missing or disabled URL shows a setup surface instead.

The embedded page is separate from the main application session. Desktop views use a separate session partition. Browser views use a sandboxed frame. This limits remote content access to the client session.

References: apps/…/WebView.tsx• L22-153

Presentation viewer

The presentation viewer turns the children of a presentation note into a slide show. It supports slide navigation, an overview, full-screen playback, and a path back to the note that supplies the current slide. A named theme supplies the visual style, with a white theme as the fallback for an unknown name.

References: apps/…/index.tsx• L20-145 apps/…/themes.ts• L1-73

Canvas and drawing surfaces

Canvas notes and drawings provide a visual surface for free-form content. They support shapes, images, reusable drawing items, and links to notes while respecting the client theme and read-only state. A drawing can also appear inside another note or serve as the visual form of an image.

The editable scene stays separate from image attachments and the generated picture used for previews or shared pages. When an image becomes a drawing, the source image remains a locked background. Canvas links open notes through normal client navigation, while embedded notes use the shared content renderer and are disposed when the embed is removed.

References: apps/…/Canvas.tsx• L28-58 apps/…/Canvas.tsx• L90-145 apps/…/drawing_view.ts• L15-73 apps/…/image_to_drawing.ts• L14-57 apps/…/persistence.ts• L365-453 apps/…/NoteEmbeddable.tsx• L7-49

Change checklist

When these files or sections are changed, remember to consider these:

  • Search result IDs, page details, matched terms, snippets, attributes, page size, and pagination must remain one contract between the result list and the detail request.
  • A new search run must reset paging and refresh details for the active search note. Older requests must not replace newer page details.
  • Result links must keep the matched terms that the destination uses for highlighting. Fallback terms must exclude regex-only tokens.
  • Search cards must keep live note identity separate from server detail data so title, icon, path, protected content, and expanded content do not disagree.
  • Collection filter membership must stay separate from view order. The stored query, input state, errors, newest-run check, and newly created notes must remain one contract.
  • Mind-map stored data, sanitization, node links, memo state, icon rendering, preview output, and export consumers must remain compatible.
  • Mind-map control state must stay aligned with the map instance across zoom, focus, direction, full-screen changes, locale changes, and rebuilds.
  • Read-only mind maps must keep inspection and memo reading available while blocking edits to node data and links.
  • Space-usage chart categories, reclaim estimates, cleanup choices, selection identity, note paths, and refresh behavior must remain aligned.
  • Embedded web-view isolation must remain consistent across desktop and browser hosts.
  • Canvas scene content, image attachments, generated pictures, note embeds, theme state, and read-only behavior must remain aligned across canvas notes, drawings, previews, and shared pages.

Important failure modes

TriggerConsequenceGuard
A search result detail request finishes after the user changes page.Old snippets can appear on the new page.Keep a request sequence and accept only the newest response.
A search runs again with the same result IDs but the detail request is not forced to run.Cards can show old snippets or matched terms.Refresh details for the matching search execution event.
A result opens without the note’s matched terms.The destination cannot show the same search context.Prefer returned matched terms and fall back to plain query tokens.
A protected note is treated as an empty result.The user cannot tell unavailable content from no content.Show an explicit unavailable-snippet state.
A map node keeps unsafe stored markup or an unsafe link.The viewer can execute unwanted content or follow a hostile address.Sanitize node markup and render unsupported links inert.
A mind-map icon is dressed without preserving export input.Saving or exporting the map can fail or lose the icon.Keep export-readable icon content and add portable icon drawings.
A memo commit is applied after the selection changes.Text meant for one node can overwrite another node’s memo.Bind pending edits to the selection that showed them.
Cleanup changes storage but the page is not refreshed.The charts continue to report old space use.Start a new usage request after cleanup completes.
An embedded page shares the application session.Remote content can gain access to client session data.Use an isolated desktop partition or sandboxed browser frame.
Canvas content loads after the user switches notes.Images or scene data from the old note can appear in the new canvas.Ignore async loads that no longer belong to the active note.

Key files

FileWhy to read it
apps/…/quick_search.tsxShows the path from query input to result dropdown, highlighting, keyboard navigation, and full-search handoff.
apps/…/SearchResultsList.tsxShows result count, page size, paging, lazy detail loading, and refresh behavior.
apps/…/SearchResultCard.tsxShows how a result becomes a linked card with live title, path, snippet, matched terms, and expansion.
apps/…/useSearchResultDetails.tsShows the page-level detail request and stale-response guard.
apps/…/SearchDefinition.tsxShows search options, pending-query handling, result refresh, bulk actions, and saved-search creation.
apps/…/collection_filter.tsxShows how a query narrows collection membership without changing view order.
apps/…/note_tree.tsShows how saved-search branches, note paths, clone-aware moves, hidden subtrees, and active-note context meet in the main hierarchy.
apps/…/index.tsxShows how grouped notes become an editable board.
apps/…/data.tsxShows how table rows and columns refresh during edits.
apps/…/index.tsxShows map search, note creation, drawing, tracks, and selection.
apps/…/RelationMap.tsxShows how a map note becomes a visual set of notes and links.
packages/…/relation-map.tsShows how current relations and inverse names reach the map.
apps/…/index.tsxShows how storage overview, browse, refresh, and cleanup fit together.
apps/…/cleanup_dialog.tsxShows how reclaim choices are estimated and applied.
packages/…/space_usage.tsDefines occupied and reclaimable space.
apps/…/ImageViewer.tsxShows shared image inspection behavior.
apps/…/MindMap.tsxShows the interactive mind-map surface, stored-data loading, safety boundary, preview generation, and read-only behavior.
apps/…/MapToolbar.tsxShows map direction, scale, focus, centering, and full-screen controls.
apps/…/NodePanel.tsxShows node formatting, images, links, tags, and memo access.
apps/…/NodeMemo.tsxShows the memo editing contract across selection changes.
apps/…/icons.tsShows how node icons remain usable in both the live map and exports.
apps/…/links.tsShows note-link and external-link safety rules.
apps/…/Pdf.tsxShows how PDF state connects to note context and saving.
apps/…/MediaPlayer.tsxShows playback, sibling navigation, active-player ownership, and system media controls.
apps/…/WebView.tsxShows setup states and the isolation boundary for remote pages.
apps/…/index.tsxShows how presentation notes become navigable slides.
apps/…/Canvas.tsxShows the canvas surface, note links, embedded notes, theme, and read-only behavior.
apps/…/persistence.tsShows how canvas scenes, images, drawings, and preview pictures move between the client and note storage.