Solr数据导入处理程序无法更新,但调试显示它应该

时间:2018-03-12 16:38:10

标签: solr dataimporthandler

问题是当我们调试数据导入时,它说文档的值应该改变,但是值不是查询。

这是dataimport的输出。

{
  "responseHeader": {
    "status": 0,
    "QTime": 0
  },
  "initArgs": [
    "defaults",
    [
      "config",
      "esp-config.xml"
    ]
  ],
  "command": "status",
  "status": "idle",
  "importResponse": "",
  "statusMessages": {
    "Total Requests made to DataSource": "15",
    "Total Rows Fetched": "27",
    "Total Documents Processed": "1",
    "Total Documents Skipped": "0",
    "Full Dump Started": "2018-03-12 13:24:41",
    "": "Indexing completed. Added/Updated: 1 documents. Deleted 0 documents.",
    "Committed": "2018-03-12 13:24:42",
    "Optimized": "2018-03-12 13:24:42",
    "Time taken": "0:0:1.467"
  }
}

这是dataimpor-debug的输出(修改为不显示合理数据)。

{
  "responseHeader": {
    "status": 0,
    "QTime": 1507
  },
  "initArgs": [
    "defaults",
    [
      "config",
      "esp-config.xml"
    ]
  ],
  "command": "full-import",
  "mode": "debug",
  "documents": [
    {
      .... Some fields with the values document should have ....
      "_version_": [
        1594749753815466000
      ],
      "_root_": [
        "E40004178"
      ]
    }
  ],
  "verbose-output": [
    "entity:esp",
    [
      "document#1",
      [
        "query",
        "Some query",
        "time-taken",
        "0:0:0.422",
        null,
        "----------- row #1-------------",
  ... Some more data ...
  "status": "idle",
  "importResponse": "",
  "statusMessages": {
    "Total Requests made to DataSource": "15",
    "Total Rows Fetched": "27",
    "Total Documents Processed": "1",
    "Total Documents Skipped": "0",
    "Full Dump Started": "2018-03-12 13:24:41",
    "": "Indexing completed. Added/Updated: 1 documents. Deleted 0 documents.",
    "Committed": "2018-03-12 13:24:42",
    "Optimized": "2018-03-12 13:24:42",
    "Time taken": "0:0:1.467"
  }
}

solrconfig.xml上的DIH

  <requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
    <lst name="defaults">
      <str name="config">esp-config.xml</str>
    </lst>   
</requestHandler>

Dataimport配置文件

<dataConfig>
    <dataSource name="TDatasource" driver="com.ibm.db2.jcc.DB2Driver" url="${ta.datasource.url}"
                user="${ta.datasource.user}" password="${ta.datasource.pass}"/>
    <document>
        <entity name="esp" pk="ID" transformer="TemplateTransformer"
                query="SELECT * FROM ESP e                                                                                                                                               
                WHERE ('${dataimporter.request.idP}' != '' AND to_char(e.id) = '${dataimporter.request.idP}') OR                                                                        
                ('${dataimporter.request.idP}' = '' AND ('${dataimporter.request.clean}' != 'false'                                                                                            
                OR e.VERSION > '${dataimporter.last_index_time}'))">
...Some fields and child documents...
        </entity>
        <entity name="ab" pk="ID" transformer="TemplateTransformer"
                query="SELECT * FROM AB a                                                                                                                                         
                WHERE ('${dataimporter.request.idP}' != '' AND to_char(a.id) = '${dataimporter.request.idP}')                                                                           
                OR ('${dataimporter.request.idP}' = '' AND ('${dataimporter.request.clean}' != 'false' OR a.VERSION > '${dataimporter.last_index_time}'))"> 
...Some other data for this but without child documents...
</entity>                                                                                                                                                                                     
    </document> 

编辑:Solr config autoCommit和autoSoftCommit

 <autoCommit>
   <maxTime>${solr.autoCommit.maxTime:15000}</maxTime>
   <openSearcher>false</openSearcher>
 </autoCommit>
 <autoSoftCommit>
   <maxTime>${solr.autoSoftCommit.maxTime:-1}</maxTime>
 </autoSoftCommit>

问题是当通过ID搜索相同的文档时,它返回旧的版本号,而不是新的版本号1594749753815466000。

现在唯一的解决方案是按ID删除文档并再次运行索引。

我们尝试重新启动所有节点,因为可能是问题出在缓存或类似的东西上,但旧值仍然存在。

Solr version es 5.3.1

0 个答案:

没有答案