You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by okayndc <bo...@gmail.com> on 2012/05/05 15:12:03 UTC
solr: adding a string on to a field via DIH
Hello,
Is it possible to concatenate a field via DIH?
For example for the id field, in order to make it unique
I want to add 'project' to the beginning of the id field.
So the field would look like 'project1234'
Is this possible?
<field column="id" name="id" />
Thanks
Re: solr: adding a string on to a field via DIH
Posted by okayndc <bo...@gmail.com>.
Thanks guys. I had taken a quick look at
the Template Transformer and it looks it does
what I need it to do....didn't see the 'hello' part
when reviewing earlier.
On Sat, May 5, 2012 at 11:47 AM, Jack Krupansky <ja...@basetechnology.com>wrote:
> Sounds like you need a "Template Transformer": "... it helps to
> concatenate multiple values or add extra characters to field for injection."
>
> <entity name="e" transformer="**TemplateTransformer" ..>
> <field column="namedesc" template="hello${e.name},${**eparent.surname}" />
> ...
> </entity>
>
> See:
> http://wiki.apache.org/solr/**DataImportHandler#**TemplateTransformer<http://wiki.apache.org/solr/DataImportHandler#TemplateTransformer>
>
> Or did you have something different in mind?
>
> -- Jack Krupansky
>
> -----Original Message----- From: okayndc
> Sent: Saturday, May 05, 2012 9:12 AM
> To: solr-user@lucene.apache.org
> Subject: solr: adding a string on to a field via DIH
>
>
> Hello,
>
> Is it possible to concatenate a field via DIH?
> For example for the id field, in order to make it unique
> I want to add 'project' to the beginning of the id field.
> So the field would look like 'project1234'
> Is this possible?
>
> <field column="id" name="id" />
>
> Thanks
>
Re: solr: adding a string on to a field via DIH
Posted by Jack Krupansky <ja...@basetechnology.com>.
Sounds like you need a "Template Transformer": "... it helps to concatenate
multiple values or add extra characters to field for injection."
<entity name="e" transformer="TemplateTransformer" ..>
<field column="namedesc" template="hello${e.name},${eparent.surname}" />
...
</entity>
See:
http://wiki.apache.org/solr/DataImportHandler#TemplateTransformer
Or did you have something different in mind?
-- Jack Krupansky
-----Original Message-----
From: okayndc
Sent: Saturday, May 05, 2012 9:12 AM
To: solr-user@lucene.apache.org
Subject: solr: adding a string on to a field via DIH
Hello,
Is it possible to concatenate a field via DIH?
For example for the id field, in order to make it unique
I want to add 'project' to the beginning of the id field.
So the field would look like 'project1234'
Is this possible?
<field column="id" name="id" />
Thanks
Re: solr: adding a string on to a field via DIH
Posted by Michael Della Bitta <mi...@appinions.com>.
There might be a Solr way of accomplishing this, but I've always done
stuff like this in SQL (i.e. the CONCAT command). Doing it a Solr-native
way would probably be better in terms of bandwidth consumption, but just
giving you that option early in case there's not a better one.
Michael
On Sat, 2012-05-05 at 09:12 -0400, okayndc wrote:
> Hello,
>
> Is it possible to concatenate a field via DIH?
> For example for the id field, in order to make it unique
> I want to add 'project' to the beginning of the id field.
> So the field would look like 'project1234'
> Is this possible?
>
> <field column="id" name="id" />
>
> Thanks