I am using the following code in my solr project:
<document>
<entity name="node" dataSource="opennms" query="select * from node" deltaImportQuery="select * from node">
<field column="foreignid" name="id"/>
<field column="nodelabel" name="label"/>
</entity>
<entity name="service" dataSource="opennms" query="select * from service" deltaImportQuery="select * from service">
<field column="serviceid" name="id"/>
<field column="servicename" name="service_name"/>
</entity>
</document>
The id's of both the entities are the same in some cases. The problem is when i try to import the data, the id which are there in the first table gets overwritten by the id in the second table. Is there a way that i can get both of these uniquely?
I think this totally normal since id column in solr schema was declared as uniquekey. Work around that we do when we encountered same problem was we concatenated the table name with the id to make it unique. In your chase, something like:
select concat('node-', id) as nodeId from node
and
select contact('service-', id) as serviceId from service
concat function will vary on kind of database that your are using.