Improved release search function to match and concat words instead of escape characters.

This commit is contained in:
DebaucheryLibrarian 2021-02-27 22:46:52 +01:00
parent 8eebcae85d
commit 90ca08d8ac
1 changed files with 1 additions and 1 deletions

View File

@ -1012,7 +1012,7 @@ exports.up = knex => Promise.resolve()
SELECT releases.id, ranks.rank FROM (
SELECT
releases_search.release_id,
ts_rank(releases_search.document, to_tsquery('english', regexp_replace(query, '[\\s._-]+', '|', 'gi'))) AS rank
ts_rank(releases_search.document, to_tsquery('english', array_to_string(array(SELECT * FROM regexp_matches(query, '\\w+', 'g')), '|'))) AS rank
FROM releases_search
) ranks
LEFT JOIN releases ON releases.id = ranks.release_id