fixed fav search

This commit is contained in:
Radek Davidek 2026-03-04 17:03:08 +01:00
parent 0c5d5e73da
commit 23edce7dce

View File

@ -442,12 +442,45 @@ final class LibraryRepository {
OR LOWER(mode) LIKE ?
OR LOWER(url) LIKE ?
OR LOWER(favorite_key) LIKE ?
OR (
mode = 'live_category'
AND EXISTS (
SELECT 1
FROM live_streams ls
WHERE ls.category_id = favorites.ref_id
AND (LOWER(ls.name) LIKE ? OR LOWER(ls.stream_id) LIKE ?)
)
)
OR (
mode = 'vod_category'
AND EXISTS (
SELECT 1
FROM vod_streams vs
WHERE vs.category_id = favorites.ref_id
AND (LOWER(vs.name) LIKE ? OR LOWER(vs.stream_id) LIKE ?)
)
)
OR (
mode = 'series_category'
AND EXISTS (
SELECT 1
FROM series_items si
WHERE si.category_id = favorites.ref_id
AND (LOWER(si.name) LIKE ? OR LOWER(si.series_id) LIKE ?)
)
)
""");
String value = "%" + search + "%";
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
}
sql.append(" ORDER BY created_at DESC, favorite_key LIMIT ? OFFSET ?");
try (Connection connection = openConnection();
@ -495,12 +528,45 @@ final class LibraryRepository {
OR LOWER(mode) LIKE ?
OR LOWER(url) LIKE ?
OR LOWER(favorite_key) LIKE ?
OR (
mode = 'live_category'
AND EXISTS (
SELECT 1
FROM live_streams ls
WHERE ls.category_id = favorites.ref_id
AND (LOWER(ls.name) LIKE ? OR LOWER(ls.stream_id) LIKE ?)
)
)
OR (
mode = 'vod_category'
AND EXISTS (
SELECT 1
FROM vod_streams vs
WHERE vs.category_id = favorites.ref_id
AND (LOWER(vs.name) LIKE ? OR LOWER(vs.stream_id) LIKE ?)
)
)
OR (
mode = 'series_category'
AND EXISTS (
SELECT 1
FROM series_items si
WHERE si.category_id = favorites.ref_id
AND (LOWER(si.name) LIKE ? OR LOWER(si.series_id) LIKE ?)
)
)
""");
String value = "%" + search + "%";
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
args.add(value);
}
try (Connection connection = openConnection();
PreparedStatement preparedStatement = connection.prepareStatement(sql.toString())) {