jeudi 2 avril 2015

Solr DataImportHandler - Using MultiValued XML Entity in Child


Vote count:

0




Title: Solr DataImportHandler - Using MultiValued XML Entity in Child


I am using DIH to import an XML file of products, and need to use a multivalued XML field in a child entity. I essentially want to loop through all of the values for that XML entity and use each value to query another dataSource. I can easily make this work if the XML entity is one value, but if there are multiple values it becomes an array, and I don't know how to use this result in a subsequent entity.


I've created an example:


A product item's XML



<catalog>
<item>
<itemname>An Item Name</itemname>
<store>Store A</store>
<store>Store B</store>
<store>Store X</store>
</item>
</catalog>


Note: the number of stores is variable across products.


And here would be the data-config.xml



<dataConfig>
<dataSource type="FileDataSource" name="sourcefile" />
<dataSource type="URLDataSource" name="stores-service" />
<document>
<entity
name="item"
dataSource="sourcefile"
processor="XPathEntityProcessor"
forEach="/catalog/item"
url="/path/catalog.xml"
>

<field column="itemname" xpath="/catalog/item/itemname" />
<field column="store" xpath="/catalog/item/store" />

<entity
name="stores"
dataSource="stores-service"
url="http://ift.tt/1Drv4zb}"
processor="XPathEntityProcessor"
forEach="/result">
<field column="storeid" xpath="/result/storeid" />
<field column="storename" xpath="/result/storename" />
</entity>

</dataConfig>


${item.store} appears to be an array [Store A, Store B, Store C] etc. The above shoves the entire array into the URL, so it's obviously not going to work. I'm just not sure how to work with that value as an entity or if it's possible.



asked 22 secs ago







Solr DataImportHandler - Using MultiValued XML Entity in Child

Aucun commentaire:

Enregistrer un commentaire