Skip to content

topbar search only surfaces tracks — albums and artists are unreachable #321

Description

@InstaZDLL

Summary

The global search bar in the TopBar advertises itself as searching titles, artists, and albums (placeholder: "Rechercher un titre, un artiste, un album...") but the dropdown only ever renders a flat list of tracks. There is no way to land on an album page or an artist page from the search, even though the underlying FTS index already covers all three.

Reported by a user via email.

Reproduction

  1. Type an album name (e.g. "Dark Side of the Moon") into the top search bar.
  2. The dropdown shows only individual tracks from that album.
  3. There is no "Albums" section, no "Artists" section, and clicking any row plays the track — there is no way to navigate to the album detail page or the artist detail page.

Expected behavior

Spotify / Apple Music style sectioned results:

  • Top result (best match across all entities)
  • Artists — clicking opens ArtistDetailView
  • Albums — clicking opens AlbumDetailView
  • Titles — clicking plays the track (current behavior)

Root cause

The backend is fine — track_fts already indexes title + album_title + artist_name (migrations/profile/20260411120000_initial.sql:322), so typing an album or artist name already returns matching rows. The limitation is purely in the frontend:

  • src/components/layout/TopBar.tsx stores a single Track[] (line 73) populated exclusively from searchTracks / searchTracksAdvanced (src/lib/tauri/track.ts).
  • The dropdown (lines 533–562) renders one section, and the only click handler is playTracks(...) (line 205) — no setActiveView('album-detail' / 'artist-detail') path exists.
  • The placeholder string (src/i18n/locales/fr.json:213 and equivalents in the other 16 locales) therefore misrepresents what the feature actually does.

Suggested fix

  1. Backend — add search_albums(query, limit) and search_artists(query, limit) Tauri commands, probably in src-tauri/crates/app/src/commands/browse.rs, backed by the existing repository traits with LIKE/canonical_name matching (FTS is track-scoped today, so a small LIKE '%q%' against album.canonical_title and artist.canonical_name is the lowest-friction path). Return a small payload: { id, title, artwork_hash, ... } matching the shapes already used by AlbumGridCard / ArtistGridCard.
  2. Frontend wrappers — add searchAlbums / searchArtists in src/lib/tauri/browse.ts.
  3. TopBar dropdown — restructure into sections (Top result + Artists + Albums + Titles), each with its own click handler:
    • Artist row → setActiveView('artist-detail') with the artist id
    • Album row → setActiveView('album-detail') with the album id
    • Track row → playTracks (unchanged)
  4. Keep one debounced fan-out (Promise.all([searchTracks, searchAlbums, searchArtists])) so the three sections appear together.

Scope

Frontend (TopBar refactor + i18n placeholder is already accurate so no string change needed) + two new backend commands. No DB migration required since track_fts and the canonical-name columns already exist.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplannedPlanned for a future releasescope: backendRust/Tauri backend (src-tauri/)scope: frontendReact/Vite frontend (src/)

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions