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