Migration added that fixes full-text search
This commit is contained in:
parent
e8fb97c21e
commit
d895aa2d1d
1 changed files with 17 additions and 0 deletions
17
db/migrate/20141229173351_fix_search_index_in_packages.rb
Normal file
17
db/migrate/20141229173351_fix_search_index_in_packages.rb
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class FixSearchIndexInPackages < ActiveRecord::Migration
|
||||
def up
|
||||
execute "drop index packages_name"
|
||||
execute "drop index packages_description"
|
||||
execute "create index packages_fts on packages using gin((
|
||||
to_tsvector('english', coalesce(\"packages\".\"name\"::text, ''))
|
||||
||
|
||||
to_tsvector('english', coalesce(\"packages\".\"description\"::text, ''))
|
||||
||
|
||||
to_tsvector('english', coalesce(\"packages\".\"long_description\"::text, ''))
|
||||
))"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "drop index packages_fts"
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue