My database configuration is as below <entity name="x" query="SELECT ID, XMLSERIALIZE(SMRY as CLOB(1M)) as SMRY FROM BOOK_REC fetch first 40 rows only" transformer="ClobTransformer" > <field column="MBR" name="mbr" /> <entity name="y" dataSource="xmldata" dataField="x.SMRY" processor="XPathEntityProcessor" forEach="/*:summary" rootEntity="true" > <field column="card_no" xpath="/cardNo" />
</entity> </entity> and i get my response from solr as below <doc> <str name="card_no">org.......@1c8e807</str> Am i mising anything? Thanks, Prasi On Thu, Mar 20, 2014 at 4:25 PM, Gora Mohanty <g...@mimirtech.com> wrote: > On 20 March 2014 14:53, Prasi S <prasi1...@gmail.com> wrote: > > > > Hi, > > I have a requirement to index a database table with clob content. Each > row > > in my table a column which is an xml stored as clob. I want to read the > > contents of xmlthrough dih and map each of the xml tag to a separate solr > > field, > > > > Below is my clob content. > > <root> > > <author>A</author> > > <date>02-Dec-2013</date> > > . > > . > > . > > </root> > > > > i want to read the contents of the clob and map author to author_solr and > > date to date_solr . Is this possible with a clob tranformer or a script > > tranformer. > > You will need to use a FieldReaderDataSource, and a XPathEntityProcessor > along with the ClobTransformer. You do not provide details of your DIH data > configuration file, but this should look something like: > > <dataSource name="xmldata" type="FieldReaderDataSource"/> > ... > <document> > <entity name="x" query="..." transformer="ClobTransformer"> > <entity name="y" dataSource="xmldata" dataField="x.clob_column" > processor="XPathEntityProcessor" forEach="/root"> > <field column="author_solr" xpath="/author" /> > <field column="date_solr" xpath="/date" /> > </entity> > </entity> > </document> > > Regards, > Gora >