多表利用DIH批量匯入資料並建立索引注意事項

2022-03-23 07:18:11 字數 3300 閱讀 6622

如果希望同時對多個表進行全文檢索,那我們該如何處理呢?利用dih匯入資料並建立索引時。schema.xml中配置了uniquekey為id

<

uniquekey

>id

uniquekey

>

如果多表主鍵都為id的話索引會被覆蓋

<

entity

name

="case"

pk="id"

query

="select id,title, summary, 'case' as type from case"

deltaimportquery

="select id, title, summary, 'case' as type from case where id='$'"

deltaquery

="select id, title, summary, 'case' as type from case where create_time > '$'"

>

<

field

column

="id"

name

="id"

/>

<

field

column

="title"

name

="title"

/>

<

field

column

="summary"

name

="summary"

/>

entity

>

<

entity

name

="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='$'"

deltaquery

="select id, title, summary, 'case_test' as type from casetest where create_time > '$'"

>

<

field

column

="id"

name

="id"

/>

<

field

column

="title"

name

="title"

/>

<

field

column

="summary"

name

="summary"

/>

<

field

column

="type"

name

="type"

/>

entity

>

由於id是唯一鍵,如果id重複索引會被覆蓋掉。此時可以加個簡易的標識,以便構造不同表的uniquekey

修改後配置檔案

<

entity

name

="case"

pk="id"

query

="select concat('case_type_', id) as id,title, summary, 'case' as type from case"

deltaimportquery

="select concat('case_type_', id) as id, title, summary, 'case' as type from case where id='$'"

deltaquery

="select concat('case_type_', id) as id, title, summary, 'case' as type from case where create_time > '$'"

>

<

field

column

="id"

name

="id"

/>

<

field

column

="title"

name

="title"

/>

<

field

column

="summary"

name

="summary"

/>

entity

>

<

entity

name

="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='$'"

deltaquery

="select concat('case_test_type_', id) as id, title, summary, 'case_test' as type from casetest where create_time > '$'"

>

<

field

column

="id"

name

="id"

/>

<

field

column

="title"

name

="title"

/>

<

field

column

="summary"

name

="summary"

/>

<

field

column

="type"

name

="type"

/>

entity

>

利用PHPExcel批量匯入資料 用法說明

主要 段 require once iofactory.php 引入phpexcel iofactory 類檔案 objphpexcel phpexcel iofactory load path 載入load方法,其中的 path,是上傳檔案接收過來的路徑 絕對 路徑 例如 f ceshi publ...

MySQL 建立資料庫並匯入資料

root connection和一般connection的區別?what does host mean?how to configure host?what is port 3306 used for?用處?table可以設定不同於schema的字符集和規則?設定字符集和校對規則 utf8,utf8...

oracle 建立Scott並匯入練習資料

oracle11g和oracle10g自帶乙個普通使用者 scott,它的預設密碼為 tiger 並給該使用者自帶了四張二維表資料。首先要建立使用者 oracle新建使用者 1 必須使用system賬戶進行使用者建立 開啟plsql,使用system賬戶登入,注意 登入身份選擇sysdba 2 新建...