You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Manupriya <ma...@gmail.com> on 2009/01/07 15:18:35 UTC

Is there any better way to configure db-data-config.xml

Hi,

I am using the following schema - 

http://www.nabble.com/file/p21332196/table_stuct.gif 

1. INSTITUTION table is the main table that has information about all the
institutions.
2. INSTITUTION_TYPE table has 'institute_type' and its 'description' for
each 'institute_type_id' in the INSTITUTION table.
3. INSTITUTION_SOURCE_MAP table is a mapping table. This has institution_id
corresponding to source_id from external system.

NOTE - INSTITUTION table is union of institutions created internally AND
institutions corresponding to source_ids from external systems.

Requirement - 
1. Search Institutions by 'institution_name' in the INSTITUTION table.
2. Display institution_type for institution_type_id.
3. user should be able to search for institution by 'source_id' and
'source_entity_name'.

My db-data-config.xml is following - 

===============================================================================
<dataConfig>
    <dataSource driver="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://localhost:1433/dummy-master" user="dummy-master"
password="dummy-master" />
    <document name="institution">
         <entity name="INSTITUTION" pk="institution_id" query="select * from
INSTITUTION"                  
             deltaQuery="select institution_id from INSTITUTION where
last_update_date > '${dataimporter.last_index_time}'">
            <field column="institution_id" name="id" />
            <field column="institution_name" name="institutionName" />
	<field column="description" name="description" />
	<field column="institution_type_id" name="institutionTypeId" />
	  
    <entity name="INSTITUTION_TYPE" pk="institution_type_id" 
query="select institution_type from INSTITUTION_TYPE where 
institution_type_id='${INSTITUTION.institution_type_id}'"
parentDeltaQuery="select institution_type_id from INSTITUTION where
institution_type_id=${INSTITUTION_TYPE.institution_type_id}">

    <field name="institutionType" column="institution_type" />
  </entity>
</entity>

<entity name="INSTITUTION_SOURCE_MAP" pk="institution_id, source_id,
source_entity_name, source_key, source_key_field" query="select * from
INSTITUTION_SOURCE_MAP">
      <field column="source_id" name="sourceId" />
      <field column="source_entity_name" name="sourceEntityName" />

 <entity name="INSTITUTION" pk="institution_id"
 query="select * from INSTITUTION where institution_id =
'${INSTITUTION_SOURCE_MAP.institution_id}'">
           <field column="institution_id" name="id" />
          <field column="institution_name" name="institutionName" />
          <field column="description" name="description" />
          <field column="institution_type_id" name="institutionTypeId" />
		   
<entity name="INSTITUTION_TYPE" pk="institution_type_id" query="select
institution_type from INSTITUTION_TYPE where
institution_type_id='${INSTITUTION.institution_type_id}'" 		   
parentDeltaQuery="select institution_type_id from INSTITUTION where
institution_type_id=${INSTITUTION_TYPE.institution_type_id}">

         <field name="institutionType" column="institution_type" />
  </entity>
</entity>

</entity>
</document>
</dataConfig>
===============================================================================

My configuration file is working perfectly fine. I have specified two
<entity> inside on <document>.  And both the <entity> has further nested
<entity> tags.

Can anyone suggest me if there is any other/better way to configure the
relationship? :confused:

I have referred http://wiki.apache.org/solr/DataImportHandler and
http://download.boulder.ibm.com/ibmdl/pub/software/dw/java/j-solr-update-pdf.pdf

Is there any resource that has detailed information about tags used in
db-data-config.xml?

Thanks,
Manu

-- 
View this message in context: http://www.nabble.com/Is-there-any-better-way-to-configure-db-data-config.xml-tp21332196p21332196.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Is there any better way to configure db-data-config.xml

Posted by Manupriya <ma...@gmail.com>.
Hi Noble,

In my case, Institutions can be entered in two different ways.

1. Institutions information is directly present in the INSTITUTION table. 
(Note - Such institutions ARE NOT present in INSTITUTION_SOURCE_MAP table.).

In this case, I have INSTITUTION as the parent entity. And INSTITUTION_TYPE
as child entry in order to retrieve the institution_type.

2. Institutions are mapped to INSTITUTION table through
INSTITUTION_SOURCE_MAP table. (In this case, user can search institutions
based on INSTITUTION_SOURCE_MAP fields.) 

So here INSTITUTION_SOURCE_MAP table is parent entity. And INSTITUTION is
the child entity.

How else can I specify the relationship?

Thanks,
Manu


Noble Paul നോബിള്‍ नोब्ळ् wrote:
> 
> why do you have multiple root entities ?
> 
> 
> 
> On Wed, Jan 7, 2009 at 7:48 PM, Manupriya <ma...@gmail.com>
> wrote:
>>
>> Hi,
>>
>> I am using the following schema -
>>
>> http://www.nabble.com/file/p21332196/table_stuct.gif
>>
>> 1. INSTITUTION table is the main table that has information about all the
>> institutions.
>> 2. INSTITUTION_TYPE table has 'institute_type' and its 'description' for
>> each 'institute_type_id' in the INSTITUTION table.
>> 3. INSTITUTION_SOURCE_MAP table is a mapping table. This has
>> institution_id
>> corresponding to source_id from external system.
>>
>> NOTE - INSTITUTION table is union of institutions created internally AND
>> institutions corresponding to source_ids from external systems.
>>
>> Requirement -
>> 1. Search Institutions by 'institution_name' in the INSTITUTION table.
>> 2. Display institution_type for institution_type_id.
>> 3. user should be able to search for institution by 'source_id' and
>> 'source_entity_name'.
>>
>> My db-data-config.xml is following -
>>
>> ===============================================================================
>> <dataConfig>
>>    <dataSource driver="net.sourceforge.jtds.jdbc.Driver"
>> url="jdbc:jtds:sqlserver://localhost:1433/dummy-master"
>> user="dummy-master"
>> password="dummy-master" />
>>    <document name="institution">
>>         <entity name="INSTITUTION" pk="institution_id" query="select *
>> from
>> INSTITUTION"
>>             deltaQuery="select institution_id from INSTITUTION where
>> last_update_date > '${dataimporter.last_index_time}'">
>>            <field column="institution_id" name="id" />
>>            <field column="institution_name" name="institutionName" />
>>        <field column="description" name="description" />
>>        <field column="institution_type_id" name="institutionTypeId" />
>>
>>    <entity name="INSTITUTION_TYPE" pk="institution_type_id"
>> query="select institution_type from INSTITUTION_TYPE where
>> institution_type_id='${INSTITUTION.institution_type_id}'"
>> parentDeltaQuery="select institution_type_id from INSTITUTION where
>> institution_type_id=${INSTITUTION_TYPE.institution_type_id}">
>>
>>    <field name="institutionType" column="institution_type" />
>>  </entity>
>> </entity>
>>
>> <entity name="INSTITUTION_SOURCE_MAP" pk="institution_id, source_id,
>> source_entity_name, source_key, source_key_field" query="select * from
>> INSTITUTION_SOURCE_MAP">
>>      <field column="source_id" name="sourceId" />
>>      <field column="source_entity_name" name="sourceEntityName" />
>>
>>  <entity name="INSTITUTION" pk="institution_id"
>>  query="select * from INSTITUTION where institution_id =
>> '${INSTITUTION_SOURCE_MAP.institution_id}'">
>>           <field column="institution_id" name="id" />
>>          <field column="institution_name" name="institutionName" />
>>          <field column="description" name="description" />
>>          <field column="institution_type_id" name="institutionTypeId" />
>>
>> <entity name="INSTITUTION_TYPE" pk="institution_type_id" query="select
>> institution_type from INSTITUTION_TYPE where
>> institution_type_id='${INSTITUTION.institution_type_id}'"
>> parentDeltaQuery="select institution_type_id from INSTITUTION where
>> institution_type_id=${INSTITUTION_TYPE.institution_type_id}">
>>
>>         <field name="institutionType" column="institution_type" />
>>  </entity>
>> </entity>
>>
>> </entity>
>> </document>
>> </dataConfig>
>> ===============================================================================
>>
>> My configuration file is working perfectly fine. I have specified two
>> <entity> inside on <document>.  And both the <entity> has further nested
>> <entity> tags.
>>
>> Can anyone suggest me if there is any other/better way to configure the
>> relationship? :confused:
>>
>> I have referred http://wiki.apache.org/solr/DataImportHandler and
>> http://download.boulder.ibm.com/ibmdl/pub/software/dw/java/j-solr-update-pdf.pdf
>>
>> Is there any resource that has detailed information about tags used in
>> db-data-config.xml?
>>
>> Thanks,
>> Manu
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Is-there-any-better-way-to-configure-db-data-config.xml-tp21332196p21332196.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 
> -- 
> --Noble Paul
> 
> 

-- 
View this message in context: http://www.nabble.com/Is-there-any-better-way-to-configure-db-data-config.xml-tp21332196p21346513.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Is there any better way to configure db-data-config.xml

Posted by Noble Paul നോബിള്‍ नोब्ळ् <no...@gmail.com>.
why do you have multiple root entities ?



On Wed, Jan 7, 2009 at 7:48 PM, Manupriya <ma...@gmail.com> wrote:
>
> Hi,
>
> I am using the following schema -
>
> http://www.nabble.com/file/p21332196/table_stuct.gif
>
> 1. INSTITUTION table is the main table that has information about all the
> institutions.
> 2. INSTITUTION_TYPE table has 'institute_type' and its 'description' for
> each 'institute_type_id' in the INSTITUTION table.
> 3. INSTITUTION_SOURCE_MAP table is a mapping table. This has institution_id
> corresponding to source_id from external system.
>
> NOTE - INSTITUTION table is union of institutions created internally AND
> institutions corresponding to source_ids from external systems.
>
> Requirement -
> 1. Search Institutions by 'institution_name' in the INSTITUTION table.
> 2. Display institution_type for institution_type_id.
> 3. user should be able to search for institution by 'source_id' and
> 'source_entity_name'.
>
> My db-data-config.xml is following -
>
> ===============================================================================
> <dataConfig>
>    <dataSource driver="net.sourceforge.jtds.jdbc.Driver"
> url="jdbc:jtds:sqlserver://localhost:1433/dummy-master" user="dummy-master"
> password="dummy-master" />
>    <document name="institution">
>         <entity name="INSTITUTION" pk="institution_id" query="select * from
> INSTITUTION"
>             deltaQuery="select institution_id from INSTITUTION where
> last_update_date > '${dataimporter.last_index_time}'">
>            <field column="institution_id" name="id" />
>            <field column="institution_name" name="institutionName" />
>        <field column="description" name="description" />
>        <field column="institution_type_id" name="institutionTypeId" />
>
>    <entity name="INSTITUTION_TYPE" pk="institution_type_id"
> query="select institution_type from INSTITUTION_TYPE where
> institution_type_id='${INSTITUTION.institution_type_id}'"
> parentDeltaQuery="select institution_type_id from INSTITUTION where
> institution_type_id=${INSTITUTION_TYPE.institution_type_id}">
>
>    <field name="institutionType" column="institution_type" />
>  </entity>
> </entity>
>
> <entity name="INSTITUTION_SOURCE_MAP" pk="institution_id, source_id,
> source_entity_name, source_key, source_key_field" query="select * from
> INSTITUTION_SOURCE_MAP">
>      <field column="source_id" name="sourceId" />
>      <field column="source_entity_name" name="sourceEntityName" />
>
>  <entity name="INSTITUTION" pk="institution_id"
>  query="select * from INSTITUTION where institution_id =
> '${INSTITUTION_SOURCE_MAP.institution_id}'">
>           <field column="institution_id" name="id" />
>          <field column="institution_name" name="institutionName" />
>          <field column="description" name="description" />
>          <field column="institution_type_id" name="institutionTypeId" />
>
> <entity name="INSTITUTION_TYPE" pk="institution_type_id" query="select
> institution_type from INSTITUTION_TYPE where
> institution_type_id='${INSTITUTION.institution_type_id}'"
> parentDeltaQuery="select institution_type_id from INSTITUTION where
> institution_type_id=${INSTITUTION_TYPE.institution_type_id}">
>
>         <field name="institutionType" column="institution_type" />
>  </entity>
> </entity>
>
> </entity>
> </document>
> </dataConfig>
> ===============================================================================
>
> My configuration file is working perfectly fine. I have specified two
> <entity> inside on <document>.  And both the <entity> has further nested
> <entity> tags.
>
> Can anyone suggest me if there is any other/better way to configure the
> relationship? :confused:
>
> I have referred http://wiki.apache.org/solr/DataImportHandler and
> http://download.boulder.ibm.com/ibmdl/pub/software/dw/java/j-solr-update-pdf.pdf
>
> Is there any resource that has detailed information about tags used in
> db-data-config.xml?
>
> Thanks,
> Manu
>
> --
> View this message in context: http://www.nabble.com/Is-there-any-better-way-to-configure-db-data-config.xml-tp21332196p21332196.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
>



-- 
--Noble Paul