lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeffrey Chang <jclal...@gmail.com>
Subject Re: FW: DIH relating multiple DataSources
Date Mon, 28 Mar 2011 07:33:45 GMT
I'll reply the solution to this thread on my own (with a different email
address).

Did some debugging on 1.4.1 source code, my issue is in the data-config.xml
file, the field column name when stored in Map object uses the DBs column
casing (e.g. ID --> id):

<entity name="parentEntity" ...>
<field column="ID" name="XXX" />
...
   <entity "childEntity" ... query="select * from jctest where
ID='${parentEntity.ID}'">
...

The config above does not work because the parentEntity.ID, the "ID" token
when compared in the Map object is stored as 'id'. If I change
parentEntity.ID to parentEntity.id (lower case id) then it works.

Perhaps the class *VariableResolverImpl *should consider a case insensitive
Map get?
Thanks,
Jeff
On Mon, Mar 28, 2011 at 3:18 PM, <jeffrey_chang@trend.com.tw> wrote:

>
>
> -----Original Message-----
> From: Jeffrey Chang (IS-TW)
> Sent: Saturday, March 26, 2011 9:00 PM
> To: solr-user@lucene.apache.org
> Subject: DIH relating multiple DataSources
>
> Hi All,
>
> I'm a newbie to SOLR and is hoping to get some help.
>
> I was able to get DIH to work with one datasource. What I'm trying to
> achieve is using two datasources to build my document. Below is my
> data-config:
>
> <dataConfig>
> <dataSource name="localDB" driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://localhost:3306/ebook" user="ebook" password="masked"
> batchSize="1" />
> <dataSource name="remoteDB" driver="com.mysql.jdbc.Driver"
> url="jdbc:mysql://tw-stntlab1:3306/test" user="root" password="masked"
> batchSize="1" />
>    <document name="epub">
>                <entity dataSource="localDB" rootEntity="true" name="epub"
> pk="ID" query="select * from epub">
>            <field column="ID" name="id" />
>            <field column="Name" name="url" />
>            <field column="Author" name="content" />
>                        <entity dataSource="remoteDB" name="test"
> query="select TESTCOLUMN from jctest where ID='${epub.ID}'">
>                                <field column="TESTCOLUMN" name="title" />
>                        </entity>
>        </entity>
>    </document>
> </dataConfig>
>
> If the above possible? I can't seem to get my "title" field above populated
> from a second datasource but the fields identified in my rootEntity using
> the first datasource works perfectly fine.
>
> Thanks,
> Jeff
> TREND MICRO EMAIL NOTICE
> The information contained in this email and any attachments is confidential
> and may be subject to copyright or other intellectual property protection.
> If you are not the intended recipient, you are not authorized to use or
> disclose this information, and we request that you notify us by reply mail
> or telephone and delete the original message from your mail system.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message