Refactor postgres search

This commit is contained in:
Michał Gątkowski 2022-08-08 01:16:45 +02:00
parent 30b4976381
commit b88b3f5de8

View File

@ -236,7 +236,7 @@ func (db *postgresDatabase) QueryTorrents(
{{ end }}
{{ if and .QueryExists .FirstPage }} WHERE {{ end }}
{{ if .QueryExists }}
to_tsvector(replace(replace(name, '.', ' '), '-', ' ')) @@ websearch_to_tsquery('{{ .Query }}')
to_tsvector(regexp_replace(name, '\W+', ' ', 'g')) @@ websearch_to_tsquery('{{ .Query }}')
{{ end }}
ORDER BY {{.OrderOn}} {{AscOrDesc .Ascending}}
LIMIT {{.Limit}};