Fix search: allow spaces and match multi-word queries as separate words

Space was hard-coded as the global play/pause toggle, so it never reached
the search-typing logic - typing "geolino azte" would toggle playback
instead of adding the space. Now a space is appended to an in-progress
search instead.

Search also required the whole query to be one contiguous substring of
title + artist, which misses queries like "conni rad" for "Conni lernt
Rad fahren" or "geolino azte" for a podcast episode titled "Azteken" by
"GEOlino Spezial" (title comes before artist). Each word is now matched
independently, in any order.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-11 12:11:36 +02:00
parent a3b2c0ce2f
commit 829ea89386
3 changed files with 44 additions and 7 deletions

View File

@@ -208,8 +208,12 @@ export function handleKey(
if (media) return media;
}
// Space is the one other transport key reachable from anywhere, same as Shift+media.
// Space is the one other transport key reachable from anywhere, same as Shift+media -
// except mid-search, where a space is punctuation the query needs (e.g. "geolino azte").
if (key === " ") {
if (state.page === "music" && state.view === "browse" && state.openAlbumId === null && !state.showHelp && state.search) {
return [{ type: "ui", patch: { search: state.search + " ", selIndex: 0 } }];
}
return [{ type: "pop", freq: 340 }, { type: "toggle" }];
}