Skip to content

Instantly share code, notes, and snippets.

View davesouth's full-sized avatar

Dave South davesouth

View GitHub Profile
@davesouth
davesouth / gist:5699181
Last active December 18, 2015 00:49
Nested mapping of multiple types
# 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' }
},
@davesouth
davesouth / gist:126091
Created June 8, 2009 21:58
Transliterate to lowercase, letters and numbers
# 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!(/\'/, '')