Indexando documentos no Solr do MongoDB

Precisaremos dos jar’s

Solr Mongo Importer – solr-mongo-importer.jar
Mongo Java driver JAR – mongo.jar
os jar’s devem estar na pasta do solr “../../dist/”

Adicione as libs no seu solrconfig.xml

<lib path="../../dist/solr-mongo-importer.jar" />
<lib path="../../dist/mongo.jar" />

depois configure seu data-config.xml

Example de uso:

<?xml version="1.0" encoding="UTF-8" ?>
<dataConfig>
     <dataSource name="MyMongo" type="MongoDataSource" database="Inventory" />
     <document name="Products">
         <entity processor="MongoEntityProcessor"
                 query="{'Active':1}"
                 collection="ProductData"
                 datasource="MyMongo"
                 transformer="MongoMapperTransformer" >
             <field column="title"           name="title"       mongoField="Title"/>
             <field column="description"     name="description" mongoField="Long Description"/>
             <field column="brand"           name="brand"  />
         </entity>
     </document>
 </dataConfig>