Skip to content

Instantly share code, notes, and snippets.

@lucascs lucascs/mapper.rb
Last active Dec 24, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.