Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The sample XML is not well formed. This might explain errors indexing the files:</p> <pre><code>$ xmllint sample.xml sample.xml:13: parser error : expected '&gt;' &lt;/Merchants&gt; ^ sample.xml:14: parser error : Premature end of data in tag Merchants line 3 sample.xml:14: parser error : Premature end of data in tag AMMF line 2 </code></pre> <h1>Corrected XML</h1> <p>Here's what I think your sample data should look like (Didn't check the XSD file) </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;AMMF xmlns="http://tempuri.org/XMLSchema.xsd" Version="11.2" CreateDate="2011-11-07T17:05:14" ProcessorBINCIB="422443" ProcessorName="WorldPay" FileSequence="18"&gt; &lt;Merchants Count="153"&gt; &lt;Merchant ChangeIndicator="A" LocationCountry="840"&gt; &lt;AcquirerBID&gt;10029881&lt;/AcquirerBID&gt; &lt;AcquirerName&gt;WorldPay&lt;/AcquirerName&gt; &lt;AcquirerMerchantID&gt;*&lt;/AcquirerMerchantID&gt; &lt;/Merchant&gt; &lt;Merchant ChangeIndicator="A" LocationCountry="840"&gt; &lt;AcquirerBID&gt;10029882&lt;/AcquirerBID&gt; &lt;AcquirerName&gt;WorldPay2&lt;/AcquirerName&gt; &lt;AcquirerMerchantID&gt;Hello World!&lt;/AcquirerMerchantID&gt; &lt;/Merchant&gt; &lt;/Merchants&gt; &lt;/AMMF&gt; </code></pre> <h1>Alternative solution</h1> <p>I know you said you're not a programmer, but this task is significantly simpler, if you use the <a href="http://wiki.apache.org/solr/Solrj" rel="nofollow">solrj</a> interface.</p> <p>The following is a groovy example which indexes your example XML</p> <pre><code>// // Dependencies // ============ import org.apache.solr.client.solrj.SolrServer import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer import org.apache.solr.common.SolrInputDocument @Grapes([ @Grab(group='org.apache.solr', module='solr-solrj', version='3.5.0'), ]) // // Main // ===== SolrServer server = new CommonsHttpSolrServer("http://localhost:8983/solr/"); def i = 1 new File(".").eachFileMatch(~/.*\.xml/) { it.withReader { reader -&gt; def ammf = new XmlSlurper().parse(reader) ammf.Merchants.Merchant.each { merchant -&gt; SolrInputDocument doc = new SolrInputDocument(); doc.addField("id", i++) doc.addField("bid_s", merchant.AcquirerBID) doc.addField("name_s", merchant.AcquirerName) doc.addField("merchantId_s", merchant.AcquirerMerchantID) server.add(doc) } } } server.commit() </code></pre> <p>Groovy is a Java scripting language that does not require compilation. It would be just as easy to maintain as a DIH config file.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload