1
votes

i'm using apache solr version 6.4.1 on windows 10 .i want to load data from mysql database into solr core but it does not works. here is the scenario : there is a core named ako in directory \solr-6.4.1\solr-6.4.1\server\solr and files solrconfig.xml & db-data-config.xml in directory \solr-6.4.1\solr-6.4.1\server\solr\ako\conf . i added needed lines of code to solrconfig.xml as below :

<requestHandler name="/dataimport" class="solr.DataImportHandler">
  <lst name="defaults">
    <str name="config">db-data-config.xml</str>
  </lst>
</requestHandler> 

<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-6.4.1.jar" />
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-extras-6.4.1.jar" />
<lib dir="${solr.install.dir:../../../..}/contrib/extraction/lib" regex=".*\.jar" />

and below is content of file db-data-config.xml:

<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/meeva" user="root" password=""/>
    <document>
    <entity name="businesses" query="select id, title from businesses">
        <field column="id" name="biz_id" />
        <field column="title" name="biz_title" />
    </entity>
</document>
</dataConfig>

i added scema.xml file with this below content , but still does not work:

<field name="biz_id" type="int" indexed="true" stored="true" required="true" multiValued="false" />

<field name="biz_title" type="string" indexed="true" stored="true"/>

but when importing data from solr admin page ( go to http://localhost:8983/solr/#/ako/dataimport//dataimport?command=full-import) it returns Requests: 0 , Fetched: 0 , Skipped: 0 , Processed: 0 and nothing is added to core.can anyone help please?

1
do you have the schema.xml?Abhijit Bashetti
@AbhijitBashetti no i have not? and i don,t know how to use itako
could you please check the below links cwiki.apache.org/confluence/display/solr/…Abhijit Bashetti
i'll check it ...thanksako

1 Answers

0
votes

It is not enough to have solr-dataimporter handler enabled. You need to enable mysql-connector as well. Go to mysql archives: https://downloads.mysql.com/archives/c-j/ Choose version close to date release of your Solr version. Download it, and copy .jar file, e.g. mysql-connector-java-5.1.41-bin.jar to your solr libs directory (probably, this is /dist directory under your solr installation path).

You got to restart Solr service to apply this.