Skip to content
This repository was archived by the owner on Sep 27, 2022. It is now read-only.
This repository was archived by the owner on Sep 27, 2022. It is now read-only.

Fuzzy search with international fields #29

@abournier

Description

@abournier

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions