Improved release search function to match and concat words instead of escape characters.
This commit is contained in:
parent
8eebcae85d
commit
90ca08d8ac
|
@ -1012,7 +1012,7 @@ exports.up = knex => Promise.resolve()
|
||||||
SELECT releases.id, ranks.rank FROM (
|
SELECT releases.id, ranks.rank FROM (
|
||||||
SELECT
|
SELECT
|
||||||
releases_search.release_id,
|
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
|
FROM releases_search
|
||||||
) ranks
|
) ranks
|
||||||
LEFT JOIN releases ON releases.id = ranks.release_id
|
LEFT JOIN releases ON releases.id = ranks.release_id
|
||||||
|
|
Loading…
Reference in New Issue