简体   繁体   English

通过 searchkick 进行多语言搜索

[英]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?是否可以同时使用两种语言进行搜索?

Under the hood, searchkick uses either the stemmer token filter or the snowball token filter .在幕后,searchkick 使用stemmer提取器标记过滤器snowball标记过滤器

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.这两个过滤器都只接受language参数中的一个值,因此如果您决定指定一种语言,它要么是一种语言,要么是另一种。

An alternative is to use different fields for different languages (eg title_en for english and title_ru for russian) and apply a different analyzer and language-specific stemmer for each.一个替代方案是使用不同语言的不同字段(例如title_en英语和title_ru对于俄语)和应用不同的分析仪和特定语言的词干为每个。 You can find a detailed example here .您可以在此处找到详细示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM