Fix authors search

This commit is contained in:
2022-02-06 13:35:08 +03:00
parent d50728d100
commit c759e0edc0
3 changed files with 21 additions and 35 deletions

View File

@@ -17,11 +17,9 @@ SELECT ARRAY(
) as sml,
(
SELECT count(*) FROM translations
LEFT JOIN books
ON (books.id = book AND
books.is_deleted = 'f' AND
books.lang = ANY(:langs ::text[]))
WHERE author = authors.id
LEFT JOIN books ON (books.id = book)
WHERE author = authors.id AND books.is_deleted = 'f' AND
books.lang = ANY(:langs ::text[])
) as books_count
FROM authors
WHERE (
@@ -31,11 +29,9 @@ SELECT ARRAY(
) AND
EXISTS (
SELECT * FROM translations
LEFT JOIN books
ON (books.id = book AND
books.is_deleted = 'f' AND
books.lang = ANY(:langs ::text[]))
WHERE author = authors.id
LEFT JOIN books ON (books.id = book)
WHERE author = authors.id AND books.is_deleted = 'f' AND
books.lang = ANY(:langs ::text[])
)
)
SELECT fauthors.id FROM filtered_authors as fauthors