lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Noble Paul നോബിള്‍ नोब्ळ् <noble.p...@gmail.com>
Subject Re: Problem using DIH templatetransformer to create uniqueKey
Date Fri, 13 Feb 2009 10:31:29 GMT
the intent was to not to make a partial string if some of the variable
are missing

probably we can enhance TemplateTransformer by using an extra
attribute on the field

 <field column="id" template="${jc.fileAbsolutePath}${x.vurl}"
ignoreMissingVariables="true"/>

then it can just resolve with whatever is available...



On Fri, Feb 13, 2009 at 3:17 PM, Fergus McMenemie <fergus@twig.me.uk> wrote:
> Hello,
>
> templatetransformer behaves rather ungracefully if one of the replacement
> fields is missing.
>
> I am parsing a single XML document into multiple separate solr documents.
> It turns out that none of the source documents fields can be used to create
> a uniqueKey alone. I need to combine two, using template transformer as
> follows:
>
> <entity name="x"
>  dataSource="myfilereader"
>  processor="XPathEntityProcessor"
>  url="${jc.fileAbsolutePath}"
>  rootEntity="true"
>  stream="false"
>  forEach="/record | /record/mediaBlock"
>  transformer="DateFormatTransformer,TemplateTransformer,RegexTransformer"
>   >
>
>  <field column="fileAbsolutePath"    template="${jc.fileAbsolutePath}" />
>  <field column="fileWebPath"         regex="${dataimporter.request.installdir}(.*)"
replaceWith="/ford$1" sourceColName="fileAbsolutePath"/>
>  <field column="id"                  template="${jc.fileAbsolutePath}${x.vurl}" />
>  <field column="vurl"                xpath="/record/mediaBlock/mediaObject/@vurl"
/>
>
> The trouble is that vurl is only defined as a child of "/record/mediaBlock"
> so my attempt to create id, the uniqueKey fails for the parent document "/record"
>
> I am hacking around with "TemplateTransformer.java" to sort this but was
> wondering if there was a good reason for this behavior.
>
> Regards.
> --
>
> ===============================================================
> Fergus McMenemie               Email:fergus@twig.me.uk
> Techmore Ltd                   Phone:(UK) 07721 376021
>
> Unix/Mac/Intranets             Analyst Programmer
> ===============================================================
>



-- 
--Noble Paul

Mime
View raw message