Multi-table using Dih to bulk import data and establish indexing considerations

Source: Internet
Author: User

If you want to do a full-text search of multiple tables at the same time, how do we handle them? When importing data using Dih and indexing. Schema.xml configured with UniqueKey as ID

< UniqueKey >ID</uniquekey>

If multiple table primary keys are IDs, the index will be overwritten

    <!--Deltaimportquery and deltaquery are used for incremental import.  -    <Entityname= "Case"PK= "id"Query= "Select Id,title, Summary, ' case ' as-type ' from case"Deltaimportquery= "SELECT ID, title, summary, ' case ' as type ' from ' WHERE id= ' ${dih.delta.id} '"Deltaquery= "SELECT ID, title, summary, ' case ' as-type ' from the case WHERE create_time > ' ${dih.last_index_time} '"      >      <!--Field is used to configure the correspondence between field and database fields in Schema.xml. Column: Name of the field in the database, configured in Name:schema.xml -      <Fieldcolumn= "id"name= "id"/>      <Fieldcolumn= "title"name= "title"/>             <Fieldcolumn= "Summary"name= "Summary"/>      </Entity>    <!--Deltaimportquery and deltaquery are used for incremental import.  -    <Entityname= "Casetest"PK= "id"Query= "Select Id,title, Summary, ' case_test ' as type from Casetest"Deltaimportquery= "SELECT ID, title, summary, ' case_test ' as type ' from Casetest WHERE id= ' ${dih.delta.id} '"Deltaquery= "SELECT ID, title, summary, ' case_test ' as type ' from Casetest WHERE create_time > ' ${dih.last_index_time} '"      >      <!--Field is used to configure the correspondence between field and database fields in Schema.xml. Column: Name of the field in the database, configured in Name:schema.xml -      <Fieldcolumn= "id"name= "id"/>      <Fieldcolumn= "title"name= "title"/>             <Fieldcolumn= "Summary"name= "Summary"/>      <Fieldcolumn= "type"name= "type"/>    </Entity>

Because the ID is a unique key, if the ID duplicate index is overwritten. At this point, you can add a simple identifier to construct the UniqueKey of the different tables.

Post-modification configuration file

    <!--Deltaimportquery and deltaquery are used for incremental import.  -    <Entityname= "Case"PK= "id"Query= "Select Concat (' Case_type_ ', id) as Id,title, summary, ' case ' as-Type ' from the case"Deltaimportquery= "Select Concat (' Case_type_ ', id) as ID, title, summary, ' case ' as Type ' from ' WHERE id= ' ${dih.delta.id} '"Deltaquery= "Select Concat (' Case_type_ ', id) as ID, title, summary, ' case ' as-Type ' from the case WHERE create_time > ' ${dih.last_ Index_time} ' "      >      <!--Field is used to configure the correspondence between field and database fields in Schema.xml. Column: Name of the field in the database, configured in Name:schema.xml -      <Fieldcolumn= "id"name= "id"/>      <Fieldcolumn= "title"name= "title"/>             <Fieldcolumn= "Summary"name= "Summary"/>      </Entity>    <!--Deltaimportquery and deltaquery are used for incremental import.  -    <Entityname= "Casetest"PK= "id"Query= "Select Concat (' Case_test_type_ ', id) as Id,title, summary, ' Case_test ' as Type from Casetest"Deltaimportquery= "Select Concat (' Case_test_type_ ', id) as ID, title, summary, ' case_test ' as Type ' from Casetest WHERE id= ' ${dih.delta '. ID} ' "Deltaquery= "Select Concat (' Case_test_type_ ', id) as ID, title, summary, ' case_test ' as Type ' from Casetest WHERE create_time ; ' ${dih.last_index_time} ' "      >      <!--Field is used to configure the correspondence between field and database fields in Schema.xml. Column: Name of the field in the database, configured in Name:schema.xml -      <Fieldcolumn= "id"name= "id"/>      <Fieldcolumn= "title"name= "title"/>             <Fieldcolumn= "Summary"name= "Summary"/>      <Fieldcolumn= "type"name= "type"/>    </Entity>

Multiple tables use Dih to bulk import data and establish indexing considerations

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.