[ https://issues.apache.org/jira/browse/SOLR-2039?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12934190#action_12934190 ]
pavlick commented on SOLR-2039: ------------------------------- how i understand, the issue is that DIH cannot import dynamic fields with specific field names. for example, i have following +schema.xml+ {color:green} <dynamicField name="*_s" type="string" indexed="true" stored="true" multiValued="true" /> {color} +data-config.xml+ {color:green} <entity name="items" query="select * from item"> <field name="${items.item_name}_s" column="item_value" /> </entity> {color} DB with following content |*item_name*|*item_value*| |item1 |value1 | |item2 |value2 | and i want to Solr indexed my data such way, that i would get something like this {color:green} <doc> <str name="item1_s"> value1 </str> <str name="item2_s"> value2 </str> </doc> {color} > Multivalued fields with dynamic names does not work properly with DIH > --------------------------------------------------------------------- > > Key: SOLR-2039 > URL: https://issues.apache.org/jira/browse/SOLR-2039 > Project: Solr > Issue Type: Bug > Components: contrib - DataImportHandler > Affects Versions: 1.4.1 > Environment: Windows XP, Default Solr 1.4 install with jetty > Reporter: K A > > Attempting to use multiValued fields using the DataImportHandler with dynamic > names does not seem to work as intended. > Setting up the following in schema.xml > <dynamicField name="*_s" type="string" indexed="true" stored="true" > multiValued="true" /> > Then attempting to import a multiValued field through a RDBMS using children > records with a dynamic name. The snippet from data-config.xml > <entity name="terms" query="select distinct DESC_TERM from tem_metadata where > item_id=${item.ID_PK}"> > <entity name="metadata" query="select * from > term_metadata where item_id=${item.ID_PK} AND desc_term='${terms.DESC_TERM}'" > > > <field name="${terms.DESC_TERM}_s" > column="TEXT_VALUE" /> > </entity> > </entity> > Results in only the FIRST record being imported. If we change the field name > in the above example to a constant (ie above field entry becomes: <field > name="metadata_record_s" column="TEXT_VALUE" />). The multiple records are > correctly imported. > This was posted on solr-user, and others have reported the problem on the > mailing list archive. > The workaround was to use a javascript transform to perform the same > behavior. Changes in data-config.xml become: > <entity name="metadata" query="select * from vw_item_metadata where > item_id=${item.DIVID_PK} AND core_desc_term='${terms.CORE_DESC_TERM}'" > transformer="script:f1"/> > <script><![CDATA[ > function f1(row) { > var name = row.get('CORE_DESC_TERM'); > var value = row.get('TEXT_VALUE') > row.put(name+ '_s', value); > > return row; > } > ]]></script> > This results in multivalued field with a dynamic name assigned. > -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org