Now we modify the solrconfig.xml file. Add the following :
<!-- REQUEST HANDLER FOR DATAIMPORTHANDLER -->
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">mysql-config.xml</str>
</lst>
</requestHandler>
create file mysql-config.xml This is for the Data Import Handler configuration. It should look similar to:
<dataConfig>
<dataSource type="JdbcDataSource" driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://HOST/mydb" user="users"
password="secret" />
<document>
<entity name="user" query="SELECT id, name from users">
<field column="id" name="id" />
<field column="name" name="name" />
<entity name="birthday" query="select birthday from table where id=${user.id}">
<field column="description" name="description" />
</entity>
</entity>
</document>
</dataConfig></dataConfig>
For other database engines enter the specific driver, url, user and password attributes.
We now need to modify the fields section of the schema.xml file to something like the following snippet:
<field name="id" type="string" indexed="true" stored="true"
required="true"/>
<field name="name" type="text" indexed="true" stored="true" />
<field name="birthday" type="text" indexed="true" stored="true"/>
<field name="description" type="" indexed="true"
stored="true"/>
http://localhost:8080/solr/dataimport?command=full-import
source
That is an extremely smart written article. I will be sure to bookmark it and return to learn extra of your useful information. Thank you for the post. I will certainly return.
ReplyDeleteHi, Really great effort. Everyone must read this article. Thanks for sharing.
ReplyDeleteAmazing blog and very interesting stuff you got here!
ReplyDelete