I am trying to achieve search by connecting to multiple Databases (in my case
trying with 2 different DBs) to index data from multiple DB tables.
I have tried doing the below as an approach to achieve my goal but in vain,
I am able to get only data from the DB 1 when I perform a full-import.
Steps performed :
1.  Added multiple data source in the data-config.xml file as shown below :

<dataSource name="db1" type="JdbcDataSource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://10.10.10.10;databaseName=TestDB1;" user="TestUser"   
password="TestUser$"/>
<dataSource name="db2" type="JdbcDataSource"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://10.10.10.10;databaseName=TestDB2;" user="TestUser"   
password="TestUser$"/>

2. Added multiple entities against each data source added as shown below :

<entity dataSource="db1" name="Document" transformer="RegexTransformer"
pk="Id" query="select * from MyTestTable">
<field column="Id" name="Id"/>
<field column="Name" name="Name"/>
</entity>

<entity dataSource="db2" name="Document1" transformer="RegexTransformer"
pk="EmpId" query="select * from MySampleTable" >
<field column="EmpId" name="EmpId"/>
<field column="EmpName" name="EmpName"/>
</entity>

3. Added appropriate fields in the managed-schema.xml file as well

<field name="Id" type="text_general" indexed="true" stored="true"
required="true" multiValued="false" />
<field name="Name" type="text_general" indexed="true" stored="true"
required="false" multiValued="false" />

<field name="EmpId" type="text_general" indexed="true" stored="true"
required="false" multiValued="false" />
<field name="EmpName" type="text_general" indexed="true" stored="true"
required="false" multiValued="false" />

4. Reloaded the collection for the changes to take affect.
5. Performed a full import. even observed that the data has not got imported
from DB2.
6. Did a search only to find the data from DB1 is getting fetched where as
data from DB2 is not at all getting fetched.

Suggestions/Guidance shall be highly appreciated.
Please let me know in case you need any further information.

Note :  I tried connecting 2 different DBs on 2 different servers and also 2
different DBs on same server as well.

Thank you in advance!!




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html

Reply via email to