I have an XML for swallowing in Solr, which sounds like a use case that is intended for a DataImportHandler solution. What I want to do is infer a column name from one XML attribute and a value from another attribute. Here is an example of what I mean:
<document> <data ref="reference.foo"> <value>bar</value> </data> </document>
From this xml snippet, I want to add a field named reference.foo and value bar . DataImportHandler includes an XPathEntityProcessor for processing XML documents. I tried using it, and it works fine if I give it a known column name (for example, <field column="ref" xpath="/document/data/@ref"> ), but could not find any documentation or examples to suggest how to do what I want, or what he cannot do. So:
- Can I do this with XPathEntityProcessor? If so, how?
- If not, can I do it the other way using the DataImportHandler?
- Or did I leave with writing my own import handler?
source share