fix(users/Profpatsch/whatcd-resolver): use artist_ids in filtered

I missed this! It speeds up `/artist` by another 50%.

Change-Id: I138c38185ea7fb606a139b436b9c956f7b8e1a37
Reviewed-on: https://cl.tvl.fyi/c/depot/+/13244
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
This commit is contained in:
Profpatsch 2025-03-11 11:48:57 +01:00
parent d379e1742f
commit ca6c5ac59e

View file

@ -678,7 +678,7 @@ getBestTorrents opts = do
ON (NOT ?::bool OR is_favourite)
WHERE
-- filter by artist id
(?::bool OR (to_jsonb(?::int) <@ (jsonb_path_query_array(full_json_result, '$.artists[*].id'))))
(?::bool OR (?::int = any (artist_ids)))
-- filter by torrent ids
AND
(?::bool OR torrent_id = ANY (?::int[]))