mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FIX: correct old username index
(in some cases search was not finding accounts)
This commit is contained in:
parent
f73aa444ee
commit
b4844d4477
2 changed files with 12 additions and 1 deletions
|
@ -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?
|
||||
|
|
11
db/migrate/20141118011735_correct_username_search.rb
Normal file
11
db/migrate/20141118011735_correct_username_search.rb
Normal file
|
@ -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 a new issue