Avoid alias when matching FTS table
This commit is contained in:
parent
8111d8985e
commit
6d00906fc9
1 changed files with 10 additions and 10 deletions
20
script.js
20
script.js
|
@ -877,8 +877,8 @@
|
||||||
const searchSql = {
|
const searchSql = {
|
||||||
rank: `
|
rank: `
|
||||||
SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre
|
SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre
|
||||||
FROM fts_tracks f
|
FROM fts_tracks
|
||||||
JOIN tracks t ON t.id = f.rowid
|
JOIN tracks t ON t.id = fts_tracks.rowid
|
||||||
JOIN artists a ON a.id = t.artist_id
|
JOIN artists a ON a.id = t.artist_id
|
||||||
LEFT JOIN albums al ON al.id = t.album_id
|
LEFT JOIN albums al ON al.id = t.album_id
|
||||||
WHERE fts_tracks MATCH ?
|
WHERE fts_tracks MATCH ?
|
||||||
|
@ -887,8 +887,8 @@
|
||||||
`,
|
`,
|
||||||
alpha: `
|
alpha: `
|
||||||
SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre
|
SELECT t.id, a.name AS artist, t.title, IFNULL(al.title, '') AS album, t.year, t.genre
|
||||||
FROM fts_tracks f
|
FROM fts_tracks
|
||||||
JOIN tracks t ON t.id = f.rowid
|
JOIN tracks t ON t.id = fts_tracks.rowid
|
||||||
JOIN artists a ON a.id = t.artist_id
|
JOIN artists a ON a.id = t.artist_id
|
||||||
LEFT JOIN albums al ON al.id = t.album_id
|
LEFT JOIN albums al ON al.id = t.album_id
|
||||||
WHERE fts_tracks MATCH ?
|
WHERE fts_tracks MATCH ?
|
||||||
|
@ -898,8 +898,8 @@
|
||||||
};
|
};
|
||||||
const countSql = `
|
const countSql = `
|
||||||
SELECT COUNT(*) AS count
|
SELECT COUNT(*) AS count
|
||||||
FROM fts_tracks f
|
FROM fts_tracks
|
||||||
JOIN tracks t ON t.id = f.rowid
|
JOIN tracks t ON t.id = fts_tracks.rowid
|
||||||
JOIN artists a ON a.id = t.artist_id
|
JOIN artists a ON a.id = t.artist_id
|
||||||
LEFT JOIN albums al ON al.id = t.album_id
|
LEFT JOIN albums al ON al.id = t.album_id
|
||||||
WHERE fts_tracks MATCH ?
|
WHERE fts_tracks MATCH ?
|
||||||
|
@ -1102,8 +1102,8 @@
|
||||||
const ftsCountSql = `
|
const ftsCountSql = `
|
||||||
SELECT COUNT(*) AS count FROM (
|
SELECT COUNT(*) AS count FROM (
|
||||||
SELECT a.id
|
SELECT a.id
|
||||||
FROM fts_tracks f
|
FROM fts_tracks
|
||||||
JOIN tracks t ON t.id = f.rowid
|
JOIN tracks t ON t.id = fts_tracks.rowid
|
||||||
JOIN artists a ON a.id = t.artist_id
|
JOIN artists a ON a.id = t.artist_id
|
||||||
WHERE fts_tracks MATCH ?
|
WHERE fts_tracks MATCH ?
|
||||||
GROUP BY a.id
|
GROUP BY a.id
|
||||||
|
@ -1111,8 +1111,8 @@
|
||||||
`;
|
`;
|
||||||
const ftsRowsSql = `
|
const ftsRowsSql = `
|
||||||
SELECT a.id, a.name
|
SELECT a.id, a.name
|
||||||
FROM fts_tracks f
|
FROM fts_tracks
|
||||||
JOIN tracks t ON t.id = f.rowid
|
JOIN tracks t ON t.id = fts_tracks.rowid
|
||||||
JOIN artists a ON a.id = t.artist_id
|
JOIN artists a ON a.id = t.artist_id
|
||||||
WHERE fts_tracks MATCH ?
|
WHERE fts_tracks MATCH ?
|
||||||
GROUP BY a.id
|
GROUP BY a.id
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue