Delta-import collects the data but don't update the solr Index

为君一笑 提交于 2019-12-11 04:30:07

问题


I've a solr Index that I am doing DIH with a mysql DB.

When I run the delta-import command, the 4 inserted rows in DB since last full import is being collected, but the index is not updated!

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

Here's the 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 &gt; '${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>

But still the index is not being updated... How can I solve this problem?

Here's the conf files for the core:
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
Thanks.


回答1:


Try this:

go to your /blob/master/db/conf/dataimport.properties Add following:

#  URL params [mandatory]
#  remainder of URL
params=/select?qt=/dataimport&command=delta-import&clean=false&commit=true

Check http://wiki.apache.org/solr/DataImportHandler this documentation.

What is important is the commit=true. Check if you see new data if you do a manual commit by running

http://localhost:8080/solr/update?commit=true


来源:https://stackoverflow.com/questions/20167950/delta-import-collects-the-data-but-dont-update-the-solr-index

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!