You can do it by giving each database data source a "name" attribute, which is what you reference in the dataSource attribute of your entity.

See:
http://wiki.apache.org/solr/DataImportHandler#multipleds

Or, are you in fact trying to join or merge the tables based on first name and last name or something similar?

-- Jack Krupansky

-----Original Message----- From: Kay
Sent: Monday, June 11, 2012 11:59 AM
To: solr-user@lucene.apache.org
Subject: Indexing Multiple Datasources

Hello,

We have 2 MS SQL Server Databases which we wanted to index .But most of the
columns in the Databases have the same names. For e.g. Both the DB’s have
the columns First name ,Last name ,etc.

How can you index multiple Databases using single db-data-config file and
one schema?

Here is my data-config file
<dataConfig>

<dataSource type="JdbcDataSource" name="ds-2"
driver="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:sqlserver://localhost;DatabaseName= " user="" password="" />
   <document name="PersonTable">
<entity dataSource="ds-2" name="People" query="SELECT
BusinessEntityID,FirstName,LastName FROM dbo.PersonTable">
<field column="BusinessEntityID" name="BusinessEntityID" />
<field column="FirstName" name="FirstName" />
<field column="LastName" name="LastName" />
<field column="Department" name="Department" />
<field column="Age" name="Age" />

</entity>
</document>

   <document name="person">
<entity dataSource="ds-1" name="People" query="SELECT
BusinessEntityID,NameStyle,Title,FirstName,MiddleName,LastName,ModifiedDate
FROM AdventureWorks.Person.Person">
<field column="BusinessEntityID" name="BusinessEntityID" />
<field column="NameStyle" name="NameStyle" />
<field column="Title" name="Title" />
<field column="FirstName" name="FirstName" />
<field column="MiddleName" name="MiddleName" />
<field column="LastName" name="LastName" />
<field column="ModifiedDate" name="ModifiedDate" />
</entity>
   </document>

</dataConfig>
And schema file:

<fields>
<field name="BusinessEntityID" type="string" indexed="true" stored="true"
required="true"/>
<field name="NameStyle" type="string" indexed="true" stored="true"/>
<field name="Title" type="string" indexed="true" stored="true"/>
<field name="FirstName" type="string" indexed="true" stored="true"/>
<field name="MiddleName" type="string" indexed="true" stored="true"/>
<field name="LastName" type="string" indexed="true" stored="true"/>
<field name="Department" type="string" indexed="true" stored="true"/>
<field name="Age" type="string" indexed="true" stored="true"/>
</fields>
<uniqueKey>BusinessEntityID</uniqueKey>

<defaultSearchField>LastName</defaultSearchField>


We would appreciate your help!

Thanks!


--
View this message in context: http://lucene.472066.n3.nabble.com/Indexing-Multiple-Datasources-tp3988957.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to