mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 11:58:33 +08:00
PERF: only use fulltext when searching for a user (I checked, it's enough)
This commit is contained in:
@ -382,11 +382,12 @@ class Search
|
||||
return if SiteSetting.hide_user_profiles_from_public && !@guardian.user
|
||||
|
||||
users = User.includes(:user_search_data)
|
||||
.where("active = true AND user_search_data.search_data @@ #{ts_query("simple")}")
|
||||
.references(:user_search_data)
|
||||
.where("active = TRUE")
|
||||
.where("user_search_data.search_data @@ #{ts_query("simple")}")
|
||||
.order("CASE WHEN username_lower = '#{@original_term.downcase}' THEN 0 ELSE 1 END")
|
||||
.order("last_posted_at DESC")
|
||||
.limit(@limit)
|
||||
.references(:user_search_data)
|
||||
|
||||
users.each do |user|
|
||||
@results.add(user)
|
||||
|
Reference in New Issue
Block a user