You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by jimtronic <ji...@gmail.com> on 2012/11/21 17:10:56 UTC

Using XML DataImporter, need to set default attribute when missing

The external xml file that I'm trying to import has an attribute that is only
present sometimes. I need to use this value as a commonField and it appears
to be retaining the previous value for every row.

The xml looks something like this:

<restaurant id="XXX">
<menus>
 <menu type="lunch">
  <item price="6.00">Burrito</item>
 </menu>
 <menu>
   <item price="10.00">Pizza</item>
 </menu>
</menus>
</restaurant>

I'm inserting items into my core and I use commonFields to retain the
restaurant info and the menu type.

The problem occurs when a menu element doesn't have an attribute. In this
case, it continues to code everything as menu type "lunch".

How can I write the xpath to handle this?

Thanks!



--
View this message in context: http://lucene.472066.n3.nabble.com/Using-XML-DataImporter-need-to-set-default-attribute-when-missing-tp4021633.html
Sent from the Solr - User mailing list archive at Nabble.com.