Skip to content

Instantly share code, notes, and snippets.

@lucascs
Last active December 24, 2015 15:19
Show Gist options
  • Save lucascs/6818763 to your computer and use it in GitHub Desktop.
Save lucascs/6818763 to your computer and use it in GitHub Desktop.
Tire configuration for pt-BR
class Mapper
def self.map!(options = {})
drop_index! if options[:delete]
Tire.index :index_name do
create :analysis => {
:filter => {
:pt_br_filter => {
:type => :stemmer,
:language => :minimal_portuguese
}
},
:analyzer => {
:pt_br_text => {
:tokenizer => :standard,
:filter => [:lowercase, :pt_br_filter, :standard, :asciifolding],
}
}
}
put_mapping :something, {
:_all => { :analyzer => 'pt_br_text' },
:properties => {
:field_name => { :type => 'string', :analyzer => 'pt_br_text' }
}
}
refresh
end
end
def self.drop_index!
Tire.index(:index_name) { delete }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment