[英]Merge 2 different languages into into single SOLR index using suffix - then how to query
I know that there are similar questions about solr and I read them all and some give insights but not a solution for exaclty what I am trying to do. 我知道关于solr也有类似的问题,我都阅读了所有这些问题,有些问题提供了见解,但不是解决我想做的事情的解决方案。
Right now we only index the english version so I want to add the Spanish version into the solr index also. 现在我们只索引英文版本,因此我也想将西班牙文版本添加到solr索引中。 As the eventid is identical in both tables I don't want to have that included for the indexing portion but obviously we will need it to pull the data from both tables using the same eventid. 由于两个表中的eventid相同,因此我不想为索引部分包括该ID,但显然我们需要使用相同的eventID从两个表中提取数据。
So my questions are: 所以我的问题是:
I did not set up the original config for SOLR so I would appreciate you letting me know which files need to be modified to get this all to work. 我没有为SOLR设置原始配置,所以希望您让我知道需要修改哪些文件才能使所有这些正常工作。 eg solr-config.xml and schema.xml - plus any I am not aware of. 例如solr-config.xml和schema.xml-加上我不知道的任何内容。
I am also open to a completely different solution to the one I outlined - as long as its not too complex. 我也愿意对我概述的解决方案提出完全不同的解决方案-只要它不太复杂即可。
Thanks. 谢谢。
This is usually implemented by having separate versions of the field in the schema for each language, such as name_en
, name_es
, description_en
, description_es
etc. (as you write). 这通常是通过在模式中为每种语言使用不同的字段版本来实现的,例如name_en
, name_es
, description_en
, description_es
等(在您编写时)。
If you're using DIH, you can perform a join in the query (or use a nested entity) to retrieve the fields from the alternative language table as well. 如果您使用的是DIH,则还可以在查询中执行联接(或使用嵌套实体),以从备用语言表中检索字段。
If you know which language you're querying in, you can use qf
(query fields) to tell Solr which fields to search. 如果知道要查询的语言,则可以使用qf
(查询字段)告诉Solr要搜索哪些字段。 name_es,description_es
if the search is in Spanish, name_en,description_en
if it's in English. name_es,description_es
如果使用西班牙语), name_en,description_en
如果使用英语)。
There are also a feature in more recent versions of Solr (3.5 and up) for explicit Language Detection . Solr的最新版本(3.5及更高版本)中还具有用于显式语言检测的功能 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.