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 "solruser@9913" <gu...@yahoo.com> on 2011/07/27 03:50:55 UTC
Conditional field values in DataImport
This may be a trivial question - I am noob :).
In the dataimport of a CSV file, am trying to assign a field based on a
conditional check on another field.
E.g.
<field name="rawLine" regex="CSV-splitting-regex" groupNames="X,Y,Z" />
this works well. However I need to create another field A that is
assigned a value based on X.
Something like this
If X contains "abc" then A="complex-action" else A="SimpleAction"
<field name="A" regex="check contains regex" then do what? />
I can do all the way upto writing the second regex for checking the value
inside X - however i am not sure how to assign the conditional value to A
based on a match or fail
Any help is much appreciated.
-g
--
View this message in context: http://lucene.472066.n3.nabble.com/Conditional-field-values-in-DataImport-tp3202136p3202136.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Conditional field values in DataImport
Posted by Gora Mohanty <go...@mimirtech.com>.
On Wed, Jul 27, 2011 at 7:20 AM, solruser@9913 <gu...@yahoo.com> wrote:
> This may be a trivial question - I am noob :).
> In the dataimport of a CSV file, am trying to assign a field based on a
> conditional check on another field.
>
> E.g.
> <field name="rawLine" regex="CSV-splitting-regex" groupNames="X,Y,Z" />
>
> this works well. However I need to create another field A that is
> assigned a value based on X.
[...]
A ScriptTransformer should do the job. Please see
http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer
Regards,
Gora