mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
ilike is slow in theory, unless some sophisticated index is in place
This commit is contained in:
parent
af810f38dd
commit
c06f1438d3
1 changed files with 2 additions and 2 deletions
|
@ -13,7 +13,7 @@ class UserSearch
|
|||
end
|
||||
|
||||
if term.present?
|
||||
sql.where("username ilike :term_like or
|
||||
sql.where("username_lower like :term_like or
|
||||
to_tsvector('simple', name) @@
|
||||
to_tsquery('simple',
|
||||
regexp_replace(
|
||||
|
@ -21,7 +21,7 @@ class UserSearch
|
|||
cast(plainto_tsquery(:term) as text)
|
||||
,'\''(?: |$)', ':*''', 'g'),
|
||||
'''', '', 'g')
|
||||
)", term: term, term_like: "#{term}%")
|
||||
)", term: term, term_like: "#{term.downcase}%")
|
||||
|
||||
sql.order_by "case when username_lower = :term then 0 else 1 end asc"
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue