fuzzily icon indicating copy to clipboard operation
fuzzily copied to clipboard

Fuzzy search with international fields

Open abournier opened this issue 12 years ago • 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 ?

abournier avatar Dec 16 '13 13:12 abournier