Improve PostgreSQL serach a little
This commit is contained in:
parent
82ca499e32
commit
c1f5815b4b
@ -229,10 +229,15 @@ func (db *postgresDatabase) QueryTorrents(
|
|||||||
{{ else }}
|
{{ else }}
|
||||||
similarity(name, '{{ .Query }}') * -1
|
similarity(name, '{{ .Query }}') * -1
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{GTEorLTE .Ascending}} {{.LastOrderedValue}}
|
{{GTEorLTE .Ascending}} {{.LastOrderedValue}}
|
||||||
{{ if .QueryExists }} AND {{ end }}
|
{{ if .QueryExists }}
|
||||||
|
AND
|
||||||
|
{{ end }}
|
||||||
|
{{ end }}
|
||||||
|
{{ if and .QueryExists .FirstPage }} WHERE {{ end }}
|
||||||
|
{{ if .QueryExists }}
|
||||||
|
to_tsvector(replace(replace(name, '.', ' '), '-', ' ')) @@ plainto_tsquery('{{ .Query }}')
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ if and .QueryExists .FirstPage }} WHERE {{ end }}{{ if .QueryExists }} to_tsvector(replace(name, '.', ' ')) @@ plainto_tsquery('{{ .Query }}') {{ end }}
|
|
||||||
ORDER BY {{.OrderOn}} {{AscOrDesc .Ascending}}
|
ORDER BY {{.OrderOn}} {{AscOrDesc .Ascending}}
|
||||||
LIMIT {{.Limit}};
|
LIMIT {{.Limit}};
|
||||||
`, struct {
|
`, struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user