mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
ilike is slow in theory, unless some sophisticated index is in place
This commit is contained in:
parent
af810f38dd
commit
c06f1438d3
@ -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 New Issue
Block a user