我正在使用mysql DB进行DIH的solr索引。
当我运行delta-import
命令时,收集了自上次完全导入以来数据库中4个插入的行,但索引未更新!
841705 [qtp108251962-14] INFO org.apache.solr.handler.dataimport.DataImporter – Loading DIH Configuration: db-data-config.xml
841708 [qtp108251962-14] INFO org.apache.solr.handler.dataimport.DataImporter – Data Configuration loaded successfully
841709 [Thread-31] INFO org.apache.solr.handler.dataimport.DataImporter – Starting Delta Import
841709 [qtp108251962-14] INFO org.apache.solr.core.SolrCore – [db] webapp=/solr path=/dataimport params={command=delta-import} status=0 QTime=4
841716 [Thread-31] INFO org.apache.solr.handler.dataimport.SimplePropertiesWriter – Read dataimport.properties
841719 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Starting delta collection.
841719 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Running ModifiedRowKey() for Entity: employees
841720 [Thread-31] INFO org.apache.solr.handler.dataimport.JdbcDataSource – Creating a connection for entity employees with URL: jdbc:mysql://localhost/sampledb
841735 [Thread-31] INFO org.apache.solr.handler.dataimport.JdbcDataSource – Time taken for getConnection(): 15
841736 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Completed ModifiedRowKey for Entity: employees rows obtained : 4
841736 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Completed DeletedRowKey for Entity: employees rows obtained : 0
841736 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Completed parentDeltaQuery for Entity: employees
841743 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Delta Import completed successfully
841743 [Thread-31] INFO org.apache.solr.handler.dataimport.DocBuilder – Time taken = 0:0:0.26
841744 [Thread-31] INFO org.apache.solr.update.processor.LogUpdateProcessor – [db] webapp=/solr path=/dataimport params={command=delta-import} status=0 QTime=4 {} 0 4
这是db-data-config.xml:
<dataConfig>
<dataSource driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/sampledb" user="root" password="system" />
<document>
<entity name="employees" pk="ID"
query="SELECT * FROM employees"
deltaImportQuery="SELECT * FROM employees WHERE ID='${dataimporter.delta.id}'"
deltaQuery="SELECT ID from employees WHERE TRANSTIME > '${dataimporter.last_index_time}'">
<field column="ID" name="id" />
<field column="NAME" name="name" />
<field column="CITY" name="city" />
<field column="SERVICE_ID" name="service_id" />
</entity>
</document>
</dataConfig>
但索引仍未更新......我该如何解决这个问题?
这里是核心的conf文件:
https://github.com/MuhammadHewedy/db_cores/tree/master/db/conf
https://github.com/MuhammadHewedy/db_cores/blob/master/db/conf/db-data-config.xml
https://github.com/MuhammadHewedy/db_cores/blob/master/db/conf/schema.xml
https://github.com/MuhammadHewedy/db_cores/blob/master/db/conf/solrconfig.xml
感谢。
答案 0 :(得分:1)
试试这个:
转到/blob/master/db/conf/dataimport.properties 添加以下内容:
# URL params [mandatory]
# remainder of URL
params=/select?qt=/dataimport&command=delta-import&clean=false&commit=true
查看http://wiki.apache.org/solr/DataImportHandler此文档。
重要的是commit = true。 如果通过运行
进行手动提交,请检查是否看到新数据http://localhost:8080/solr/update?commit=true