Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help indexing XML files into Solr using DataImportHandler
    text
    copied!<p>I don't know java, I don't know XML, and I don't know Lucene. Now that that's out of the way. I have been working to create a little project using apache solr/lucene. My problem is that I am unable to index the xml files. I think I understand how its supposed to work but I could be wrong. I am not sure what information is required for you to help me so I will just post the code.</p> <pre><code>&lt;dataConfig&gt; &lt;dataSource type="FileDataSource" encoding="UTF-8" /&gt; &lt;document&gt; &lt;!-- This first entity block will read all xml files in baseDir and feed it into the second entity block for handling. --&gt; &lt;entity name="AMMFdir" rootEntity="false" dataSource="null" processor="FileListEntityProcessor" fileName="^*\.xml$" recursive="true" baseDir="C:\Documents and Settings\saperez\Desktop\Tomcat\apache-tomcat-7.0.23\webapps\solr\data\AMMF_New" &gt; &lt;entity processor="XPathEntityProcessor" name="AMMF" pk="AcquirerBID" datasource="AMMFdir" url="${AMMFdir.fileAbsolutePath}" forEach="/AMMF/Merchants/Merchant/" transformer="DateFormatTransformer, RegexTransformer" &gt; &lt;field column="AcquirerBID" xpath="/AMMF/Merchants/Merchant/AcquirerBID" /&gt; &lt;field column="AcquirerName" xpath="/AMMF/Merchants/Merchant/AcquirerName" /&gt; &lt;field column="AcquirerMerchantID" xpath="/AMMF/Merchants/Merchant/AcquirerMerchantID" /&gt; &lt;/entity&gt; &lt;/entity&gt; &lt;/document&gt; </code></pre> <p></p> <p>Example xml 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 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; </code></pre> <p>I have this in schema.</p> <pre><code>&lt;field name="AcquirerBID" type="string" indexed="true" stored="true" required="true" /&gt; &lt;field name="AcquirerName" type="string" indexed="true" stored="true" /&gt; &lt;field name="AcquirerMerchantID" type="string" indexed="true" stored="true"/&gt; </code></pre> <p>I have this in config.</p> <blockquote> <pre><code>&lt;requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler" default="true" &gt; &lt;lst name="defaults"&gt; &lt;str name="config"&gt;AMMFconfig.xml&lt;/str&gt; &lt;/lst&gt; &lt;/requestHandler&gt; </code></pre> </blockquote>
 

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