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