14 lines
607 B
Ruby
14 lines
607 B
Ruby
# PostregreSQL text searches are now using weights. So the index has to reflect that.
|
|
class MakeFulltextSearchIndexWeighted < ActiveRecord::Migration[5.0]
|
|
def change
|
|
execute "drop index packages_fts"
|
|
|
|
execute "create index packages_fts on packages using gin((
|
|
setweight( to_tsvector('english', coalesce(\"packages\".\"name\"::text, '')), 'A' )
|
|
||
|
|
setweight( to_tsvector('english', coalesce(\"packages\".\"description\"::text, '')), 'B' )
|
|
||
|
|
setweight( to_tsvector('english', coalesce(\"packages\".\"long_description\"::text, '')), 'C' )
|
|
))"
|
|
end
|
|
end
|