diff --git a/backend/konduktor/core/query.py b/backend/konduktor/core/query.py index 406f95b..e1b290c 100644 --- a/backend/konduktor/core/query.py +++ b/backend/konduktor/core/query.py @@ -105,6 +105,8 @@ class TrackIndex: if (t.artist and ql in t.artist.lower()) or (t.title and ql in t.title.lower()) or (t.album and ql in t.album.lower()) + or (t.comment and ql in t.comment.lower()) + or (t.comment2 and ql in t.comment2.lower()) ] if genre: items = [t for t in items if t.genre == genre] diff --git a/backend/test_traktor_adapter.py b/backend/test_traktor_adapter.py index b05cd2d..236e2ac 100644 --- a/backend/test_traktor_adapter.py +++ b/backend/test_traktor_adapter.py @@ -106,6 +106,13 @@ with tempfile.TemporaryDirectory() as d: adapter.set_track_metadata(tid, {"genre": "Konduktor Test Genre"}) check("metadata edit is visible in the projection", adapter.track(tid).genre == "Konduktor Test Genre") + # search reaches both comments, case-insensitively + adapter.set_track_metadata(tid, {"comment": "Konduktor Search One", + "comment2": "Konduktor Search Two"}) + for q in ("search one", "SEARCH TWO"): + hits = adapter.query_tracks(q=q, limit=20000).items + check(f"search {q!r} finds the track by its comment", + [x.id for x in hits] == [tid], f"{len(hits)} hits") # key — the projection's wheel, mode AND display text all follow t = adapter.set_key(tid, 4, "minor") # 4A = F minor = Open Key 9m diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c9d5f7b..1314995 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -40,7 +40,7 @@ function applyFilters(tracks: Track[], f: Filters): Track[] { const bpmMax = f.bpmMax ? parseFloat(f.bpmMax) : null return tracks.filter((t) => { if (q) { - const hay = `${t.artist ?? ''} ${t.title ?? ''} ${t.album ?? ''}`.toLowerCase() + const hay = [t.artist, t.title, t.album, t.comment, t.comment2].filter(Boolean).join(' ').toLowerCase() if (!hay.includes(q)) return false } if (f.genre && t.genre !== f.genre) return false diff --git a/frontend/src/components/Toolbar.tsx b/frontend/src/components/Toolbar.tsx index bb30846..abc1c8c 100644 --- a/frontend/src/components/Toolbar.tsx +++ b/frontend/src/components/Toolbar.tsx @@ -59,7 +59,7 @@ export function Toolbar({ value={filters.search} onChange={(e) => set({ search: e.target.value })} ref={searchRef} - placeholder="Search artist, title, album…" + placeholder="Artist, title, album, comment…" className="well w-72 rounded-full py-1.5 pl-9 pr-8 text-sm text-text outline-none placeholder:text-faint focus:ring-1 focus:ring-accent" /> {filters.search && (