我已经在jboss上运行4.3.1运行7.1.1。 我正在尝试索引一个简单的xml文件
<add>
<doc>
<field name="fname">test1</field>
<field name="number">1</field>
</doc>
</add>
此文件是test.xml,位于C:\ solr-input \ test.xml
中这是我的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>
它位于jboss / standalone / deployments / solr / collection1 / conf
文件夹中最后,这是我附加到solrconfig.xml
的代码<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
所以,当我运行网址时
<http://localhost:8080/solr/dataimport?command=full-import>
它说我
<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>
如果我去
<http://localhost:8080/solr/collection1/select?q=test1&wt=xml&indent=true>
它没有显示任何结果......
我做错了什么?
答案 0 :(得分:0)
我遇到了同样的问题。唯一对我有用的是添加行
<lib dir="../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
在solrconfig.xml中并将xml文件放入文件夹/ exampledocs中。现在,它正在发挥作用。我已经测试了你的例子,它运行正常。我希望它有所帮助。