天天看點

solr mysql 多表,使用Solr資料導入處理程式從mySQL将多值字段導入Solr

solr mysql 多表,使用Solr資料導入處理程式從mySQL将多值字段導入Solr

We have the following two tables in our mySQL:

mysql> describe comment;

+--------------+--------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+--------------+--------------+------+-----+---------+-------+

| id | int(11) | YES | | NULL | |

| blogpost_id | int(11) | YES | | NULL | |

| comment_text | varchar(256) | YES | | NULL | |

+--------------+--------------+------+-----+---------+-------+

mysql> describe comment_tags;

+------------+-------------+------+-----+---------+-------+

| Field | Type | Null | Key | Default | Extra |

+------------+-------------+------+-----+---------+-------+

| comment_id | int(11) | YES | | NULL | |

| tag | varchar(80) | YES | | NULL | |

+------------+-------------+------+-----+---------+-------+

Where each comment can have multiple tags. We can import the entire comment into Solr using the Data Import Handler. However I am not sure how to import the tags for each comment into a multivalued field defined the schema.xml for each comment document.

Please advise. Thanks

解決方案

Try something like this: