For (1) you probably need to write a custom transformer. Something like:
public Object transformRow(Map<String, Object> row)     {
String language_code = row.get("language_code");
String text = row.get("text");
if("en".equals(language_code))
       row.put("text_en", text);
else if if("fr".equals(language_code))
       row.put("text_fr", text);

return row;
}


For (2), it doable with regex transformer. 

"<field column="mailId" splitBy="," sourceColName="emailids"/>
The 'emailids' field in the table can be a comma separated value. So it ends up 
giving out one or more than one email ids and we expect the 'mailId' to be a 
multivalued field in Solr." [1]

[1]http://wiki.apache.org/solr/DataImportHandler#RegexTransformer


--- On Sat, 11/13/10, Andy <angelf...@yahoo.com> wrote:

> From: Andy <angelf...@yahoo.com>
> Subject: DIH for multilingual index & multiValued field?
> To: solr-user@lucene.apache.org
> Date: Saturday, November 13, 2010, 10:55 PM
> I have a MySQL table:
> 
>     CREATE TABLE documents (
>         id INT NOT NULL
> AUTO_INCREMENT,
>         language_code CHAR(2),
>         tags CHAR(30),
>         text TEXT,
>         PRIMARY KEY (id)
>     );
> 
> I have 2 questions about Solr DIH:
> 
> 1) The "langauge_code" field indicates what language the
> "text" field is in. And depending on the language, I want to
> index "text" to different Solr fields.
> 
>     # pseudo code
> 
>     if langauge_code == "en":
>         index "text" to Solr field
> "text_en"
>     elif langauge_code == "fr":
>         index "text" to Solr field
> "text_fr"
>     elif langauge_code == "zh":
>         index "text" to Solr field
> "text_zh"
>     ...
> 
> Can DIH handle a usecase like this? How do I configure it
> to do so?
> 
> 2) The "tags" field needs to be indexed into a Solr
> multiValued field. Multiple values are stored in a string,
> separated by a comma. For example, if `tags` contains the
> string "blue, green, yellow" then I want to index the 3
> values "blue", "green", "yellow" into a Solr multiValued
> field.
> 
> How do I do that with DIH?
> 
> Thanks.
> 
> 
>       
> 



Reply via email to