Solr Delta-import什么都不做

时间:2012-08-24 01:59:20

标签: tomcat solr lucene dataimporthandler dih

我是Solr的新手,无法弄清楚为什么Delta导入什么都不做,而完全导入工作正常。每当我运行Delta-import时,我都会得到相同的响应,没有提到添加任何新文档。 <{1}}列存在,只要编辑/添加该行,就会包含正确的updated_at

我是否错过了让Delta导入工作所需的东西?

timestamp

的输出
http://domain.com:8080/solr/dataimport?command=delta-import

数据-config.xml中

<response>
    <lst name="responseHeader">
        <int name="status">0</int>
        <int name="QTime">104</int>
    </lst>
    <lst name="initArgs">
        <lst name="defaults">
            <str name="config">/usr/local/solr/conf/data-config.xml</str>
        </lst>
    </lst>
    <str name="command">delta-import</str>
    <str name="status">idle</str>
    <str name="importResponse"/>
    <lst name="statusMessages">
        <str name="Total Requests made to DataSource">1</str>
        <str name="Total Rows Fetched">0</str>
        <str name="Total Documents Skipped">0</str>
        <str name="Delta Dump started">2012-08-24 01:55:07</str>
        <str name="Identifying Delta">2012-08-24 01:55:07</str>
        <str name="Deltas Obtained">2012-08-24 01:55:07</str>
        <str name="Building documents">2012-08-24 01:55:07</str>
        <str name="Total Changed Documents">0</str>
        <str name="Total Documents Processed">0</str>
        <str name="Time taken">0:0:0.9</str>
    </lst>
    <str name="WARNING">
        This response format is experimental. It is likely to change in the future.
    </str>
</response>

1 个答案:

答案 0 :(得分:1)

尝试更改文档的结构,通过实体元素包含字段元素,并为实体添加主键属性:

<entity 
    name="posts"
    pk="id"
    datasource="mysql"
    query="select id, title, description from posts"
    deltaQuery="select id from posts where updated_at > '${dataimporter.last_index_time}'"
    deltaImportQuery="select id, title, description from posts where id='${dataimporter.delta.id}'">
  <field column="id" name="id" indexed="true" stored="true" />
  <field column="title" name="title" indexed="true" stored="true" />
  <field column="description" name="description" indexed="true" stored="true" />    
</entity>