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.

Reply via email to