dongxiaoxiao1983 2014-07-01 19:14
浏览 42
已采纳

使用后缀将2种不同语言合并为单个SOLR索引 - 然后如何查询

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.

  1. I have a table events that contains the columns eventid, name, description in English
  2. I have a table esp_events that contains the columns eventID, name, description in Spanish

Right now we only index the english version so I want to add the Spanish version into the solr index also. 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.

So my questions are:

  1. How do I define the data to be indexed (name, name_esp, description, description_esp).
  2. Do I need to define a table that the data is sourced from - if so - how is that done.
  3. How do I tell the php application to request the search be done against the English or Spanish version of the fields being searched upon.

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. e.g. solr-config.xml and schema.xml - plus any I am not aware of.

I am also open to a completely different solution to the one I outlined - as long as its not too complex.

Thanks.

  • 写回答

1条回答 默认 最新

  • douliao5550 2014-07-01 21:47
    关注

    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).

    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.

    If you know which language you're querying in, you can use qf (query fields) to tell Solr which fields to search. name_es,description_es if the search is in Spanish, name_en,description_en if it's in English.

    There are also a feature in more recent versions of Solr (3.5 and up) for explicit Language Detection.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器