From 6d00906fc9fe1228c7ed69e99b4b84d8e667be86 Mon Sep 17 00:00:00 2001 From: wagesj45 Date: Thu, 18 Sep 2025 22:31:52 -0500 Subject: [PATCH] Avoid alias when matching FTS table --- script.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/script.js b/script.js index e017edf..a10632b 100644 --- a/script.js +++ b/script.js @@ -877,8 +877,8 @@ const searchSql = { rank: ` SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre - FROM fts_tracks f - JOIN tracks t ON t.id = f.rowid + FROM fts_tracks + JOIN tracks t ON t.id = fts_tracks.rowid JOIN artists a ON a.id = t.artist_id LEFT JOIN albums al ON al.id = t.album_id WHERE fts_tracks MATCH ? @@ -887,8 +887,8 @@ `, alpha: ` SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre - FROM fts_tracks f - JOIN tracks t ON t.id = f.rowid + FROM fts_tracks + JOIN tracks t ON t.id = fts_tracks.rowid JOIN artists a ON a.id = t.artist_id LEFT JOIN albums al ON al.id = t.album_id WHERE fts_tracks MATCH ? @@ -898,8 +898,8 @@ }; const countSql = ` SELECT COUNT(*) AS count - FROM fts_tracks f - JOIN tracks t ON t.id = f.rowid + FROM fts_tracks + JOIN tracks t ON t.id = fts_tracks.rowid JOIN artists a ON a.id = t.artist_id LEFT JOIN albums al ON al.id = t.album_id WHERE fts_tracks MATCH ? @@ -1102,8 +1102,8 @@ const ftsCountSql = ` SELECT COUNT(*) AS count FROM ( SELECT a.id - FROM fts_tracks f - JOIN tracks t ON t.id = f.rowid + FROM fts_tracks + JOIN tracks t ON t.id = fts_tracks.rowid JOIN artists a ON a.id = t.artist_id WHERE fts_tracks MATCH ? GROUP BY a.id @@ -1111,8 +1111,8 @@ `; const ftsRowsSql = ` SELECT a.id, a.name - FROM fts_tracks f - JOIN tracks t ON t.id = f.rowid + FROM fts_tracks + JOIN tracks t ON t.id = fts_tracks.rowid JOIN artists a ON a.id = t.artist_id WHERE fts_tracks MATCH ? GROUP BY a.id