The way I did it with SQL Server is like this: Let's say you have a field called "Company" which is multivalued, then you would declare it like this in schema.xml:
<field name="Company" type="text" indexed="true" stored="true" multiValued="true" /> in your SQL query, you would do this: select table.field1 , (select distinct cast (c.ID AS VARCHAR(10)) + ',' from table2 FOR XML PATH('') ) AS Company from table And below the query, you would declare your field like this: <field column="Company" splitBy="," /> This will get the string and automatically split the value of the field by the delimiter and create multiple nodes of that field. So you end up with <doc> ... <Company>c1</Company> <Company>c2</Company> <Company>c3</Company> Hope that helps. Moazzam http://moazzam-khan.com 2010/6/8 Alberto García Sola <alberto...@gmail.com>: > I had read http://wiki.apache.org/solr/DataImportHandler but I didn't > realize that was for multivalued. > > Than you very much! > > On Tue, Jun 8, 2010 at 8:01 AM, Alexey Serba <ase...@gmail.com> wrote: > >> Hi Alberto, >> >> You can add child entity which returns multiple records, i.e. >> >> <entity name="root" query="select id, title from titles"> >> <entity name="child" query="select value from multivalued where >> title_id='${root.id}'"> >> </entity> >> </entity> >> >> HTH, >> Alex >> >> 2010/6/7 Alberto García Sola <alberto...@gmail.com>: >> > Hello, this is my first message to this list. >> > >> > I was wondering if it is possible to use multiValued when using MySQL (or >> > any SQL-database engine) through DataImportHandler. >> > >> > I've tried using a query which return something like this: >> > 1 - title1 - multivalue1-1 >> > 1 - title1 - multivalue1-2 >> > 1 - title1 - multivalue1-3 >> > 2 - title2 - multivalue2-1 >> > 2 - title2 - multivalue2-2 >> > >> > And using the first row as ID. But that only returns me the first >> occurrence >> > rather than transforming them into multiValued fields. >> > >> > Is there a way to deal with multiValued in databases? >> > >> > NOTE: The way of working with multivalues I use is using foreign keys and >> > relate them into the query so that the query gives me the results the way >> I >> > have shown. >> > >> > Regards, >> > Alberto. >> > >> >