Below is my full configuration, <dataConfig> <dataSource driver="com.ibm.db2.jcc.DB2Driver" url="jdbc:db2://IP:port/dbname" user="" password="" /> <dataSource name="xmldata" type="FieldReaderDataSource"/>
<document> <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> </document> </dataConfig> And this is my xml data <ns:summary xmlns:ns="***"> <cardNo>ZAYQ5181</tripId> <firstName>Sam</firstName> <lastName>Mathews</lastName> <date>2013-01-18T23:29:04.492</date> </ns:summary> Thanks, Prasi On Mon, Mar 24, 2014 at 3:23 PM, Shalin Shekhar Mangar < shalinman...@gmail.com> wrote: > 1. I don't see the definition of a datasource named 'xmldata' in your > data-config. > 2. You have forEach="/*:summary" but I don't think that is a syntax > supported by XPathRecordReader. > > If you can give a sample of the xml stored as Clob in your database, > then we can help you write the right xpaths. > > On Mon, Mar 24, 2014 at 12:55 PM, Prasi S <prasi1...@gmail.com> wrote: > > 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 > >> > > > > -- > Regards, > Shalin Shekhar Mangar. >