mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-23 21:52:45 -05:00
fix(worker): parse "Artist - Title" separator in search scoring
When a user types "Everything Yes - Too Late", the scoring system was treating the entire string as the title and leaving the artist empty. This meant the +20 artist-match bonus was never applied, and the -6 title-mismatch penalty hit the correct song (whose title is just "Too Late", not "Everything Yes - Too Late"). _buildRequestContext now detects the " - " / " – " / " — " separator in the query when no explicit trackMeta is provided, and splits into artist + title for scoring. This makes "Artist - Title" queries match the correct track instead of falling back to fuzzy title-only matching.
This commit is contained in:
1 parent
49447dc37b
commit
4a436d6044
1 file changed
+10
-2
+10
-2
@@ -225,8 +225,16 @@ class YTUtils extends EventEmitter {
|
||||
}
|
||||
|
||||
_buildRequestContext(query, trackMeta = null) {
|
||||
const requestedTitle = trackMeta?.name ?? trackMeta?.title ?? query;
|
||||
const requestedArtist = trackMeta?.artist ?? "";
|
||||
let requestedTitle = trackMeta?.name ?? trackMeta?.title ?? query;
|
||||
let requestedArtist = trackMeta?.artist ?? "";
|
||||
|
||||
if (!trackMeta) {
|
||||
const dashMatch = String(query).match(/^(.+?)\s+[-–—]\s+(.+)$/);
|
||||
if (dashMatch) {
|
||||
requestedArtist = dashMatch[1].trim();
|
||||
requestedTitle = dashMatch[2].trim();
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
normalizedTitle: normalizeMatchText(requestedTitle),
|
||||
|
||||
Reference in new issue
Block a user