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 Marc Sturlese <ma...@gmail.com> on 2009/09/08 11:10:26 UTC

DIH applying variosu transformers to a field

Hey there, I am using DIH to import a db table and and have writed a custom
transformer following the example:
package foo;
public class CustomTransformer1    {
        public Object transformRow(Map<String, Object> row)     {
                String artist = row.get("artist");
                if (artist != null)             
                        row.put("ar", artist.trim());

                return row;
        }
}
I'm  wondering if I write a second transformer and put it in data-config.xml
after CustomTransformer1. Will the input value of the row in the second
transformer be the result of the transformed row in the CustomTransfomer1 or
will be the original row value?
I would just need to index the result of transformer2 (whose input would be
the output of transformer1)

config woul look like:
<entity processor="SqlEntityProcessor" name="sql_table"
transformer="CustomTransformer1,CustomTransformer2" pk="id"

I have read something similar was done in february (
https://issues.apache.org/jira/browse/SOLR-1033 ) but not sure if it's what
I ask for
Thanks in advance




-- 
View this message in context: http://www.nabble.com/DIH-applying-variosu-transformers-to-a-field-tp25342449p25342449.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: DIH applying variosu transformers to a field

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Tue, Sep 8, 2009 at 2:40 PM, Marc Sturlese <ma...@gmail.com>wrote:

>
> I'm  wondering if I write a second transformer and put it in
> data-config.xml
> after CustomTransformer1. Will the input value of the row in the second
> transformer be the result of the transformed row in the CustomTransfomer1
> or
> will be the original row value?
> I would just need to index the result of transformer2 (whose input would be
> the output of transformer1)
>
> config woul look like:
> <entity processor="SqlEntityProcessor" name="sql_table"
> transformer="CustomTransformer1,CustomTransformer2" pk="id"
>
>
Correct. Transformers in DIH are chained, so output of the first is the
input of the second.


> I have read something similar was done in february (
> https://issues.apache.org/jira/browse/SOLR-1033 ) but not sure if it's
> what
> I ask for
>

That was a different issue. That issue enabled us to use current entity's
values as variables. Previously, only the parent entity's fields (and things
like request params, evaluators etc.) were available as variables.

-- 
Regards,
Shalin Shekhar Mangar.