Users make spelling mistakes… espacially when typing the name of an exotic destination.
Show me properties of **Marakech** ! > Here are some properties in **Marrakesh**, Morroco. > Did you mean **Martanesh**, Albania, **Marakkanam**, India, or **Marasheshty**, Romania?
With a database of 10 million entries,
blurrily can find fuzzy matches for
any input string within 75ms on typical hardware. On less pathological
datasets, you can easily expect searches to take no more than a few
milliseconds, typically faster than caching!
Both gems are tested with various Ruby VMs and versions of Rails, and here at
HouseTrip we’re actually using
blurrily in production.
Fuzzily is Blurrily’s older brother. It is easier to integrate into an typical Rails application and lets you make any model’s attributes searchable:
class MyStuff < ActiveRecord::Base # assuming my_stuffs has a 'name' attribute fuzzily_searchable :name end MyStuff.find_by_fuzzy_name('Some Name', :limit => 10) #=> records
Installing and using it can be done in minutes with a typical Rails application.
Fuzzily’s younger sibling is slightly harder to integrate, but it’s crazy fast (backed by a C extension) and scales very well. You can use it as a client/server like so:
$ blurrily & $ irb -rubygems -rblurrily/client > client = Blurrily::Client.new > client.put('London', 1337) > client.find('lonndon') #=> 
$ irb -rubygems -rblurrily/map > map = > client.put('London', 1337) > client.find('lonndon') #=> 
If you have a similar problem and feel ElasticSearch or anything Lucene backed is overkill, why not give them a go!