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 Noble Paul നോബിള് नोब्ळ् <no...@gmail.com> on 2011/06/16 08:48:35 UTC
Re: Need help with DIH dataconfig.xml
Use TemplateTransformer
<dataConfig>
<dataSource
name = "wld"
type="JdbcDataSource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/wld"
user="root"
password="pass"/>
<document name="variants">
<entity name="III_1_1" query="SELECT * FROM `wld`.`III_1_1`"
transformer="TemplateTransformer>
<field column="id" template='${III_1_1.id}III_1_1"}'/>
<field column="lemmatitel" name="lemma" />
<field column="vraagtekst" name="vraagtekst" />
<field column="lexical_variant" name="variant" />
</entity>
<entity name="III_1_2" query="SELECT * FROM `wld`.`III_1_2`">
<field column="id" name='${"III_1_2_" + "id"}'/>
<field column="lemmatitel" name="lemma" />
<field column="vraagtekst" name="vraagtekst" />
<field column="lexical_variant" name="variant" />
</entity>
</document>
</dataConfig>
On Wed, Jun 15, 2011 at 4:41 PM, MartinS <ma...@gmail.com> wrote:
> Hello,
>
> I want to perform a data import from a relational database.
> That all works well.
> However, i want to dynamically create a unique id for my solr documents
> while importing by using my data config file. I cant get it to work, maybe
> its not possible this way, but i thought i would ask you ll.
> (I set up schema.xml to use the field "id" as the unique id for solr
> documents)
>
> My solr config looks like this :
>
> <dataConfig>
> <dataSource
> name = "wld"
> type="JdbcDataSource"
> driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost/wld"
> user="root"
> password="pass"/>
> <document name="variants">
> <entity name="III_1_1" query="SELECT * FROM `wld`.`III_1_1`">
> <field column="id" name='${variants.name + "id"}'/>
> <field column="lemmatitel" name="lemma" />
> <field column="vraagtekst" name="vraagtekst" />
> <field column="lexical_variant" name="variant" />
> </entity>
> <entity name="III_1_2" query="SELECT * FROM `wld`.`III_1_2`">
> <field column="id" name='${"III_1_2_" + "id"}'/>
> <field column="lemmatitel" name="lemma" />
> <field column="vraagtekst" name="vraagtekst" />
> <field column="lexical_variant" name="variant" />
> </entity>
> </document>
> </dataConfig>
>
> For a unique id I would like the concatenate the primary key of the table
> (Column id) with the table name.
> How can I do this ? Both ways as shown in the example data config don't work
> while importing.
>
> Any help is appreciated.
> Martin
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Need-help-with-DIH-dataconfig-xml-tp3066855p3066855.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
-----------------------------------------------------
Noble Paul