使用Solr索引多种语言 [英] Using Solr for indexing multiple languages

查看:626
本文介绍了使用Solr索引多种语言的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在设置一个Solr来索引文档,其中title字段可以是各种语言。谷歌搜索后,我找到了两个选项:

We're setting up a Solr to index documents where title field can be in various languages. After googling I found two options:


  1. 为每种语言定义
    的不同架构字段,即title_en,
    title_fr,。 ..对每种语言应用不同的
    过滤器,然后使用
    对应语言查询
    标题字段之一。

  2. 创建
    不同的Solr核心来处理每个
    语言并使我们的应用程序查询
    更正Solr核心。

哪一个更好?有什么起伏?

Which one is better? What are the ups and downs?

谢谢

推荐答案

还有第三种方法,您可以为所有语言使用一组通用字段,但将过滤器应用于字段语言。例如,如果您有字段 text language ,您可以将所有语言的文本内容放入 text 字段并使用例如 fq = language:english 来仅检索英文文档。

There's also a third alternative where you use a common set of fields for all languages but apply a filter to a field language. For instance if you have the fields text, language you can put text contents for all languages in to the text field and use e.g., fq=language:english to only retrieve english documents.

这种方法的缺点是你不能使用语言特定的功能,如 lemmatisation 阻止等。

The downside of this approach is that you cannot use language specific features such as lemmatisation, stemming, etc.


为每种语言定义不同的模式字段,即title_en,title_fr,... apply每种语言的不同过滤器然后用相应的语言查询其中一个标题字段。

Define different schema fields for every language i.e. title_en, title_fr,... applying different filters to each language then query one of title fields with a corresponding language.

这种方法提供了很好的灵活性,但要注意高内存存在多种语言时的消费和复杂性。这可以使用多个solr服务器来缓解。

This approach gives good flexibility, but beware of high memory consumption and complexity when many languages are present. This can be mitigated using multiple solr servers.


创建不同的Solr内核来处理每种语言并使我们的应用查询正确的Solr核心。

Creating different Solr cores to handle each language and make our app query correct Solr core.

绝对是一个不错的解决方案。但是,单独的管理和轻微的开销是否对您有用可能与您希望使用的语言数量有关。

Definately a nice solution. But whether the separate administration and slight overhead will work for you is probably in relation to the number of languages you wish to use.

除非第一种方法适用,否则我可能会倾向于第二种方法,除非不需要核心的可扩展性。这两种方法都很好,我认为它基本上归结为偏好。

Unless the first approach is applicable, I would probably lean towards the second one unless the scalability of cores isn't desired. Either approach is fine though and I think it basicaly comes down to preference.

这篇关于使用Solr索引多种语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆