mezis/fuzzily

Fuzzy search with international fields

Opened this issue · 0 comments

Hello,

I have a bad fuzzy result if I use a model with international fields.

Model:

class Category < ActiveRecord::Base
fuzzily_searchable :name_fr, :name_en, :name_de, :name_es, :name_it
end

Fill the trigrams:

Category.bulk_update_fuzzy_name_en
Category.bulk_update_fuzzy_name_fr
Category.bulk_update_fuzzy_name_de
Category.bulk_update_fuzzy_name_es
Category.bulk_update_fuzzy_name_it 

Fuzzily search:

category = Category.find_by_fuzzy_name('rouge', :limit => 1).first
=> gives me "rose" as result

What I need to do:
category = Category.find_by_fuzzy_name_fr('rouge', :limit => 1).first
=> gives me "rouge" as result

So I need to set the language in the search method to catch the right result.
The problem is I want to make the search to work without knowing the language.

Is-this possible ?