You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by MartinS <ma...@meertens.knaw.nl> on 2011/06/15 15:05:08 UTC

DIH unique solr id field problem

Hello, 

I want to perform a data import from a relational database. It has multiple
unrelated tables, each containing rows for the same kind of data. For each
row of every table i want to create a solr document. 
That all works well. 
The trouble is qith creating the solr doc id. The tables are
autoincremented, but because there are more than one, i cannot use this as a
unique id.
So I was thinking to use a combination of the inc id, together with the
table name. That would be fine for me.
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 (for 2 tables now...) 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='${III_1_1.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/DIH-unique-solr-id-field-problem-tp3067200p3067200.html
Sent from the Lucene - General mailing list archive at Nabble.com.