|
|
-
Concatenate multivalued DIH fields
neha 2011-03-29, 19:01
I have two multivalued DIH fields "fname" and "lname". I want to concatenate each of the fname and lname pairs to get a third multivalued DIH field "name". I tried this : But the result is : [Lars L., Helle K., Thomas A., Jes] [Thomsen, Iversen, Brinck, Olesen], instead of Lars L. Thomsen, Helle K. Iverson, Thomas A Brinck, Jes Oleson. Is there a way to iterate through the multivalued fields or is there something more simple to do this. Thanks, Neha -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2749988.htmlSent from the Solr - User mailing list archive at Nabble.com.
-
Re: Concatenate multivalued DIH fields
Markus Jelsma 2011-03-29, 19:10
Haven't tried your use case but i believe DIH's ScriptTransformer can do the trick. It seems to operate on rows so you can fetch both fields and add a concatenated field. http://wiki.apache.org/solr/DataImportHandler#ScriptTransformer> I have two multivalued DIH fields "fname" and "lname". I want to > concatenate each of the fname and lname pairs to get a third multivalued > DIH field "name". > > I tried this : > > > > > But the result is : [Lars L., Helle K., Thomas A., Jes] [Thomsen, Iversen, > Brinck, Olesen], instead of Lars L. Thomsen, Helle K. Iverson, Thomas A > Brinck, Jes Oleson. > > Is there a way to iterate through the multivalued fields or is there > something more simple to do this. > > Thanks, > Neha > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp27> 49988p2749988.html Sent from the Solr - User mailing list archive at > Nabble.com.
-
Re: Concatenate multivalued DIH fields
neha 2011-03-29, 19:50
Thank you for ur reply, but is there more documentation on Script Transformer?? I am newbie to Solr DIH. Can I send two rows as parameters to the script transformer function. Also what is the syntax to call the script transformer in the DIH field?? The documentation is not very clear about it. Thanks, Neha -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2750237.htmlSent from the Solr - User mailing list archive at Nabble.com.
-
Re: Concatenate multivalued DIH fields
Stefan Matheis 2011-03-30, 08:06
Neha, If you just need to combine them .. w/o further logic, http://wiki.apache.org/solr/DataImportHandler#TemplateTransformershould be enough The first Example for ScriptTransformer should be pretty clear, no? The Function (which you define as ScriptTransformer) will retrieve the current row as parameter, you could work on this row and have to return it finally. in between, you could modify the row .. add, modify, remove values, the row object is a java.util.HashMap instance Regards Stefan On Tue, Mar 29, 2011 at 9:50 PM, neha <[EMAIL PROTECTED]> wrote: > Thank you for ur reply, but is there more documentation on Script > Transformer?? I am newbie to Solr DIH. Can I send two rows as parameters to > the script transformer function. Also what is the syntax to call the script > transformer in the DIH field?? The documentation is not very clear about it. > > Thanks, > Neha > > -- > View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2750237.html> Sent from the Solr - User mailing list archive at Nabble.com. >
-
Re: Concatenate multivalued DIH fields
neha 2011-03-30, 13:22
HI, when i tried to use template transformer, it concatenates the entire multivalued field with other, not each element of the multivalued fields. [Lars L., Helle K., Thomas A., Jes] [Thomsen, Iversen, Brinck, Olesen], instead of Lars L. Thomsen, Helle K. Iverson, Thomas A Brinck, Jes Oleson. Regarding the script transformer function, it should be able to take the two multivalued rows as input and send the concatenated result out. I am not sure this is possible with script transformer. Please could you suggest an alternative. Thanks, Neha -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2753604.htmlSent from the Solr - User mailing list archive at Nabble.com.
-
Re: Concatenate multivalued DIH fields
Stefan Matheis 2011-03-30, 13:51
suggesting an alternative way .. adjust your query and use the rdbms-concat function? On Wed, Mar 30, 2011 at 3:22 PM, neha <[EMAIL PROTECTED]> wrote: > HI, when i tried to use template transformer, it concatenates the entire > multivalued field with other, not each element of the multivalued fields. > [Lars L., Helle K., Thomas A., Jes] [Thomsen, Iversen, Brinck, Olesen], > instead of Lars L. Thomsen, Helle K. Iverson, Thomas A Brinck, Jes Oleson. > > Regarding the script transformer function, it should be able to take the two > multivalued rows as input and send the concatenated result out. I am not > sure this is possible with script transformer. Please could you suggest an > alternative. > > Thanks, > Neha > > -- > View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2753604.html> Sent from the Solr - User mailing list archive at Nabble.com. >
-
Re: Concatenate multivalued DIH fields
Marcelo Iturbe 2011-03-31, 20:00
Hello, In the schema.xml file you can contenate much easier. <field name="name" type="text" indexed="true" stored="true" multiValued="true" /> <copyField source="fname" dest="name" /> <copyField source="lname" dest="name" /> </fields> Hope this helps On Tue, Mar 29, 2011 at 3:01 PM, neha <[EMAIL PROTECTED]> wrote: > I have two multivalued DIH fields "fname" and "lname". I want to > concatenate > each of the fname and lname pairs to get a third multivalued DIH field > "name". > > I tried this : > > > > > But the result is : [Lars L., Helle K., Thomas A., Jes] [Thomsen, Iversen, > Brinck, Olesen], instead of Lars L. Thomsen, Helle K. Iverson, Thomas A > Brinck, Jes Oleson. > > Is there a way to iterate through the multivalued fields or is there > something more simple to do this. > > Thanks, > Neha > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2749988.html> Sent from the Solr - User mailing list archive at Nabble.com. >
-
Re: Concatenate multivalued DIH fields
alexei 2011-04-06, 19:16
Hi Everyone, I am having an identical problem with concatenating author's first and last names stored in an xml blob. Because this field is multivalued copyfield does not work. Does anyone have a solution? Regards, Alexei -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2786506.htmlSent from the Solr - User mailing list archive at Nabble.com.
-
Re: Concatenate multivalued DIH fields
Lance Norskog 2011-04-10, 23:30
The XPathEntityProcessor allows you to use an external XSL transform file. In that you can do anything you want. Another option is to use the script transformer: http://wiki.apache.org/solr/DataImportHandler#ScriptTransformerOn Wed, Apr 6, 2011 at 12:16 PM, alexei <[EMAIL PROTECTED]> wrote: > Hi Everyone, > > I am having an identical problem with concatenating author's first and last > names stored in an xml blob. > Because this field is multivalued copyfield does not work. > > Does anyone have a solution? > > Regards, > Alexei > > -- > View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2786506.html> Sent from the Solr - User mailing list archive at Nabble.com. > -- Lance Norskog [EMAIL PROTECTED]
-
Re: Concatenate multivalued DIH fields
jimtronic 2011-04-28, 16:53
I solved this problem using the flatten="true" attribute. Given this schema <people> <person> <names> <name> <firstName>Joe</firstName> <lastName>Smith</firstName> </name> </names> </person> </people> <field column="attr_names" xpath="/people/person/names/name" flatten="true" /> attr_names is a multiValued field in my schema.xml. The flatten attribute tells solr to take all the text from the specified node and below. -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2875435.htmlSent from the Solr - User mailing list archive at Nabble.com.
-
Re: Concatenate multivalued DIH fields
alexei 2011-05-20, 20:29
Thank you for your replies guys. Personally I like the flatten="true" option. However there is still one issue with it. After stripping the tags away, I get "JoeSmith" instead of "Joe Smith" with a space (solr 3.1). Did anyone run into this issue? Cheers, Alexei -- View this message in context: http://lucene.472066.n3.nabble.com/Concatenate-multivalued-DIH-fields-tp2749988p2967017.htmlSent from the Solr - User mailing list archive at Nabble.com.
|
|