Search code examples
ruby-on-railsrubyelasticsearchsearchkick

Multilingual search by searchkick


According to this link. We can set the language where search will happen.

My application has models with English and Russian data.

Is it possible to make search in both languages simultaneously?


Solution

  • Under the hood, searchkick uses either the stemmer token filter or the snowball token filter.

    Both of those filters only accept a single value in the language parameter, so if you decide to specify a language, it's either one or the other.

    An alternative is to use different fields for different languages (e.g. title_en for english and title_ru for russian) and apply a different analyzer and language-specific stemmer for each. You can find a detailed example here.