Reputation: 487
I am trying to import data into solr from a MSSql database using Data Importer of Solr 4.0. Unfortunately, I am unable to do this. We are not getting an error in the log. When I run a full-import it continuously executes Data Import command, and does not stop. In delta import it stops after some seconds but it also doesn't import anything.
The following is my configuration. Please advise me if it is correct or not.
data-config.xml
<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
<dataSource type="JdbcDataSource" name="ds1"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver:localhost;databaseName=temp1"
user="user1"
password="123456"
readOnly="true" />
<document>
<entity name="Product" pk="Id" query="select Id,Name from Product">
<field column="Id" name="Id"/>
<field column="Name" name="Name"/>
</entity>
</document>
</dataConfig>
SolrConfig.xml
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">data-config.xml</str>
</lst>
</requestHandler>
Schema.xml
<fields>
<field name="Id" type="int" indexed="true" stored="true" required="true" />
<field name="Name" type="text" indexed="true" stored="true" required="false" />
<field name="_version_" type="long" indexed="true" stored="true"/>
</fields>
<uniqueKey>Id</uniqueKey>
<defaultSearchField>Name</defaultSearchField>
I am running the following queries:
http://localhost:8983/solr/testDataImport/dataimport?command=delta-import
Please advise me on what is going wrong here. I have added the following libraries to my core\lib directory.
Upvotes: 1
Views: 2883
Reputation: 386
I got the same error. The possible solution is
I have added following lines of code in solrconfig.xml file
<lib dir="../../../contrib/dataimporthandler/lib/" regex=".*\.jar" />
<lib dir="../../../dist/" regex="apache-solr-dataimporthandler-\d.*\.jar" />
make sure your apache-solr-dataimporthandler-4.0.jar and apache-solr-dataimporthandler-extras-4.0.jar files in the dist folder and it's in correct path.
don't forget to restart the tomcat server.
For more detail check the following Question link.
DIH(Data Import Handler) for xml files is not working in Solr4
Upvotes: 0
Reputation: 10972
I think that the delta-import doesn't commit by default. Try requesting:
http://localhost:8983/solr/testDataImport/dataimport?command=delta-import&commit=true
Upvotes: 2