1

谢谢,我编辑了我的 data-config.xml 文件

就像这样

<dataConfig>
<dataSource type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/lol"
user="root"
password="n"/>

<document name="content">
<entity name="id">
query="SELECT id from foo"
 </entity>
</document>
</dataConfig>

当我跑

http://localhost:8983/solr/dataimport?command=full-import

在浏览器上我得到了这个

<response><lst name="responseHeader"><int name="status">0</int><int name="QTime">1</int></lst><lst name="initArgs"><lst name="defaults"><str name="config">data-config.xml</str></lst></lst><str name="status">idle</str><str name="importResponse"/><lst name="statusMessages"><str name="Time Elapsed">0:0:6.299</str><str name="Total Requests made to DataSource">1</str><str name="Total Rows Fetched">0</str><str name="Total Documents Processed">0</str><str name="Total Documents Skipped">0</str><str name="Full Dump Started">2013-06-28 11:17:34</str><str name="">Indexing failed. Rolled back all changes.</str><str name="Rolledback">2013-06-28 11:17:34</str></lst><str name="WARNING">This response format is experimental. It is likely to change in the future.</str></response>

4

1 回答 1

0

我相信配置应该看起来更像(注意,查询应该是entity元素的一个属性):

  <document name="content">
    <entity name="id" query="SELECT id from foo">
      <!--I assume you have a field in Solr and a column in MySQL, both of which are named "id"-->
    </entity>
  </document>
于 2013-06-28T16:39:26.783 回答