Search code examples
solrapache-tikadataimporthandlersolr-cell

Solr : data import handler and solr cell


Is it possible to index rich document (pdf, office)... with data import handler using solr cell.

I use solr 3.2.

Thanks.


Solution

  • Solr Cell, aka ExtractingRequestHandler, uses Apache Tika behind the scenes, and the latter can easily be integrated into a DataImportHandler:

    <dataConfig>
     <!-- use any of type DataSource<InputStream> --> 
      <dataSource type="BinURLDataSource"/>
      <document>
       <!-- The value of format can be text|xml|html|none. this is the format in which the body is emited (the 'text' field) . The implicit field 'text' will have that format.
              default value is 'text'  (if not specified) . format="none" means body is not emited-->
        <entity processor="TikaEntityProcessor" tikaConfig="tikaconfig.xml" url="${some.var.goes.here}" format="text">
          <!--Do appropriate mapping here  meta="true" means it is a metadata field -->
          <field column="Author" meta="true" name="author"/>
          <field column="title" meta="true" name="docTitle"/>
          <!--'text' is an implicit field emited by TikaEntityProcessor . Map it appropriately-->
          <field column="text"/>
         </entity>
      <document>
    </dataConfig>
    

    This functionality was implemented in SOLR-1358.