FIX: correct old username index
(in some cases search was not finding accounts)
This commit is contained in:
parent
f73aa444ee
commit
b4844d4477
|
@ -66,7 +66,7 @@ class SearchObserver < ActiveRecord::Observer
|
|||
end
|
||||
end
|
||||
if obj.class == User && (obj.username_changed? || obj.name_changed?)
|
||||
SearchObserver.update_users_index(obj.id, obj.username, obj.name)
|
||||
SearchObserver.update_users_index(obj.id, obj.username_lower, obj.name.downcase)
|
||||
end
|
||||
|
||||
if obj.class == Topic && obj.title_changed?
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
class CorrectUsernameSearch < ActiveRecord::Migration
|
||||
def up
|
||||
execute "update user_search_data
|
||||
set search_data = TO_TSVECTOR('simple', username_lower || ' ' || lower(name))
|
||||
from users
|
||||
where users.id = user_search_data.user_id"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue