i've solr 4.3.1 running on jboss as 7.1.1. I'm trying to index a simple xml file
<add>
<doc>
<field name="fname">test1</field>
<field name="number">1</field>
</doc>
</add>
this file is test.xml and is in C:\\solr-input\\test.xml
Here is my data-config.xml
<dataConfig>
<dataSource type="FileDataSource" encoding="UTF-8" />
<document>
<entity name="page" processor="XPathEntityProcessor" stream="true" forEach="/doc" url="C:\solr-input\test.xml" transformer="RegexTransformer,DateFormatTransformer">
<field column="name" xpath="/add/doc/field[@name='fname']" indexed="true" />
<field column="number" xpath="/add/doc/field[@name='number']" indexed="true" />
</entity>
</document>
</dataConfig>
that it's in the folder jboss/standalone/deployments/solr/collection1/conf
And at the end, here is the code that i've appended to solrconfig.xml
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
So, when i run the url
<http://localhost:8080/solr/dataimport?command=full-import>
it says me
<response>
<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">19</int>
</lst>
<lst name="initArgs">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</lst>
<str name="command">full-import</str>
<str name="status">idle</str>
<str name="importResponse"/>
<lst name="statusMessages">
<str name="Total Requests made to DataSource">0</str>
<str name="Total Rows Fetched">0</str>
<str name="Total Documents Skipped">0</str>
<str name="Full Dump Started">2013-06-21 12:25:03</str>
<str name="">
Indexing completed. Added/Updated: 0 documents. Deleted 0 documents.
</str>
<str name="Committed">2013-06-21 12:25:04</str>
<str name="Total Documents Processed">0</str>
<str name="Time taken">0:0:0.148</str>
</lst>
<str name="WARNING">
This response format is experimental. It is likely to change in the future.
</str>
</response>
and if i go to
<http://localhost:8080/solr/collection1/select?q=test1&wt=xml&indent=true>
it doesn't show me any result...
what am i doing wrong?
I was having the same problem. The only thing that works for me was to add the line
<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
in the solrconfig.xml and put the xml file into the folder /exampledocs. Now, it is working. I've tested your example and it is working fine. I hope it helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.