![]() |
VOOZH | about |
The Apache Solr platform is a popular, blazing-fast, open source enterprise search solution built on Apache Lucene.
Apache Solr is equipped with the Data Import Handler (DIH), which can import data from databases and, XML, CSV, and JSON files. When paired with the CData JDBC Driver for MailChimp, you can easily import MailChimp data to Apache Solr. In this article, we show step-by-step how to use CData JDBC Driver in Apache Solr Data Import Handler and import MailChimp data for use in enterprise search.
> solr create -c CDataCoreFor this article, Solr is running as a standalone instance in the local environment and you can access the core at this URL: http://localhost:8983/solr/#/CDataCore/core-overview
MailChimpUniqueKeyπ Define schema in Solr for MailChimp data.
Now we are ready to use MailChimp data in Solr.
In this section, we walk through configuring the Data Import Handler.
<lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-dataimporthandler-.*\.jar" />
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">solr-data-config.xml</str>
</lst>
</requestHandler>
<dataConfig>
<dataSource driver="cdata.jdbc.mailchimp.MailChimpDriver" url="jdbc:mailchimp:APIKey=myAPIKey;">
</dataSource>
<document>
<entity name="Lists"
query="SELECT Id,MailChimpColumn1,MailChimpColumn2,MailChimpColumn3,MailChimpColumn4,MailChimpColumn5,MailChimpColumn6,MailChimpColumn7,LastModifiedDate FROM Lists"
deltaQuery="SELECT Id FROM Lists where LastModifiedDate >= '${dataimporter.last_index_time}'"
deltaImportQuery="SELECT Id,MailChimpColumn1,MailChimpColumn2,MailChimpColumn3,MailChimpColumn4,MailChimpColumn5,MailChimpColumn6,MailChimpColumn7,LastModifiedDate FROM Lists where Id=${dataimporter.delta.Id}">
<field column="Id" name="Id" ></field>
<field column="MailChimpColumn1" name="MailChimpColumn1" ></field>
<field column="MailChimpColumn2" name="MailChimpColumn2" ></field>
<field column="MailChimpColumn3" name="MailChimpColumn3" ></field>
<field column="MailChimpColumn4" name="MailChimpColumn4" ></field>
<field column="MailChimpColumn5" name="MailChimpColumn5" ></field>
<field column="MailChimpColumn6" name="MailChimpColumn6" ></field>
<field column="MailChimpColumn7" name="MailChimpColumn7" ></field>
<field column="LastModifiedDate" name="LastModifiedDate" ></field>
</entity>
</document>
</dataConfig>> solr stop -all > solr start
Using the CData JDBC Driver for MailChimp you are able to create an automated import of MailChimp data into Apache Solr. Download a free, 30 day trial of any of the hundreds of CData JDBC Drivers and get started today.
Download a free trial of the MailChimp Driver to get started:
Download NowLearn more:
π MailChimp IconComplete read-write access to MailChimp enables developers to search (Lists, Campaigns, Reports, etc.), update items, edit customers, and more, from any Java/J2EE application.