Sha256: eb3de7969dce22c15412c8bc3dab0ab362ac456a4041eec3323c22761827db8f
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
require File.expand_path('../../migration_helper', __FILE__) include MigrationHelper class AddNamesSearchConfig < ActiveRecord::Migration def up # install unaccent if it isn't installed' install_extension('unaccent') # create a new search configuration by copying an existing one. For my purposes, I wanted to use the french dictionary and # remove all the accent characters. You could equally use the english dictionary as your base, or create your own. # this is only intended to show you the basic command. execute %Q{CREATE TEXT SEARCH CONFIGURATION names_search_config ( COPY = french );} execute %Q{ALTER TEXT SEARCH CONFIGURATION names_search_config ALTER MAPPING FOR hword, hword_part, word WITH unaccent, french_stem;} execute %Q{CREATE TEXT SEARCH CONFIGURATION names_alias_search_config ( COPY = pg_catalog.simple );} execute %{ALTER TEXT SEARCH CONFIGURATION names_alias_search_config DROP MAPPING FOR email, file, float, host, int, sfloat, uint, url, url_path, version} # remove all the accent characters. execute %Q{ALTER TEXT SEARCH CONFIGURATION names_alias_search_config ALTER MAPPING FOR hword, hword_part, word WITH unaccent, simple;} end def down execute "DROP TEXT SEARCH CONFIGURATION names_search_config" execute "DROP TEXT SEARCH CONFIGURATION names_alias_search_config" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
search_steroids-0.0.1 | spec/dummy/db/migrate/20130622154705_add_names_search_config.rb |