This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CORRECT COMMAND ADDED TO BOTTOM | |
# COMMAND WORKS | |
Tire.index('contacts').delete | |
Tire.index('contacts').create settings: { | |
analysis: { | |
analyzer: { | |
phone_analyzer: { tokenizer: 'whitespace', filter: 'phone_ngram', type:'custom' } | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on permalink_fu by Rick Olsen | |
def transliterate(str) | |
# Escape str by transliterating to UTF-8 with Iconv | |
s = Iconv.iconv('ascii//ignore//translit', 'utf-8', str).to_s | |
# Downcase string | |
s.downcase! | |
# Remove apostrophes so isn't changes to isnt | |
s.gsub!(/\'/, '') |