Thanks, 
for this quick and enlightening answer! 

I didn't consider that a Transformer can create new columns. In combination 
with dynamic fields it is exactly what I was looking for.

Thanks James ^^

-----Ursprüngliche Nachricht-----
Von: Dyer, James [mailto:james.d...@ingrambook.com] 
Gesendet: Dienstag, 9. August 2011 16:03
An: solr-user@lucene.apache.org
Betreff: RE: Problem with DIH: How to map key value pair stored in 1-N relation 
from a JDBC Source?

Christian,

It looks like you should probably write a Transformer for your DIH script.  I 
assume you have a child entity set up for "PriceTable".  Add a Transformer to 
this entity that will look at the value of "currency" and "price", remove these 
from the row, then add them back in with "currency" as the field name and 
"price" as the column value.

By the way, it would likely be better if instead of field names like "EUR" and 
"CHF", you created a dynamic field entry in schema.xml with a dynamic field 
like this:

<dynamicField name="CURRENCY_*" type="tfloat" indexed="true" stored="false" />

Then have your DIH Transformer prepend "CURRENCY_" in front of the field name.  
This way should your company ever add a new currency, you wouldn't need to 
change your schema.

For more information on writing a DIH Transformer, see 
http://wiki.apache.org/solr/DIHCustomTransformer

If you would rather use a scripting language such as javascript instead of 
writing your Transformer in java, see 
http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer .

James Dyer
E-Commerce Systems
Ingram Content Group
(615) 213-4311

Reply via email to