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 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。