Sun Java System Communications Services 2005Q4 版本說明

設置國際搜尋

使用 Communications Express 或 Connector for Microsoft Outlook 在個人連絡人或公開通訊錄中搜尋特定字元是特定語言環境的作業。例如,法語使用者搜尋「Gaelle」並預期得到包含字串「Gaelle」及任何包含字串「Ga?lle」的項目。

基於語言環境決定項目呈現給使用者的方式之各種規則稱為比較規則或比較順序。比較順序提供特定語言和文化的資訊,說明如何排序給定語言字元。它會識別諸如字母表中的字母順序、如何比較重音字母和非重音字母,以及比較字串時是否存在可以忽略的字元之類的內容。比較順序還考量到關於語言的特定文化的資訊,例如讀取語言的順序 (左至右、右至左或上下)。

Sun Java System Directory Server 支援大量語言環境和比較規則 (請參閱「Sun Java System Directory Server 5 2005Q1 Administration Reference」中的「Identifying Supported Locales」)。依據您的使用者基底,首先需要選擇在您的環境中有效的語言環境。在下面,我們將使用英文 (US) 語言環境 (OID = 1.3.6.1.4.1.42.2.27.9.4.34.1) 做為範例。

若要指定執行搜尋時使用的語言環境,請使用相符的規則篩選器語法,如「Sun Java System Directory Server 5 2005Q1 Administration Reference」中的「Searching an Internationalized Directory」所述。此語法讓您指定語言環境及搜尋類型 (完全對等、子字串等)。

例如,以下篩選器將使用英文 (US) 比較規則 (1.3.6.1.4.1.42.2.27.9.4.34.1) 執行 CN 屬性的子字串比較 (.6)。篩選器查找 CN 中以「Gae」開始的字串。

cn:1.3.6.1.4.1.42.2.27.9.4.34.1.6:=Gae*

更新索引

執行 LDAP 搜尋時,大多數效能問題是因為索引不存在或未正確配置導致的。依預設,配置 Directory Server 以便為 Communications Express 或 Connector for Microsoft Outlook 發出的查詢建立索引並在合理時間內傳回。然而,國際搜尋未設置 Directory Server。因此,需要改變現有索引以便考量已選擇的比較規則。「Sun Java System Directory Server 5 2005Q1 Administration Guide」中的「Managing Indexes」小節說明了這一點。

例如,依預設 CN 屬性在 userRoot 字尾建立索引:

# ldapsearch -D "cn=Directory manager" -b 
"cn=cn,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config" 
"objectclass=*" 
cn=cn,cn=index,cn=userRoot,cn=ldbm database,cn=plugins,cn=config 
objectClass=top objectClass=nsIndex 
cn=cn 
nsSystemIndex=false 
nsIndexType=pres 
nsIndexType=eq 
nsIndexType=sub

若要使用英文 (US) 比較規則的國際搜尋使用它,請增加一個具有英文 (US) OID 的 nsMatchingRule 屬性。由於是用戶端執行子字串搜尋,因此需要將子字串字尾 (「.6」) 增加至 OID:

#ldapmodify -D "cn=Directory manager"
dn: cn=cn,cn=index,cn=userRoot,cn=ldbm database, 
 cn=plugins,cn=config
changetype: modify
add: nsMatchingRule
nsMatchingRule: 1.3.6.1.4.1.42.2.27.9.4.34.1.6 

備註 –

請勿在值的開頭或結尾增加任何空格、標籤或其他非可視字元。



備註 –

nsMatchingRule 是多值屬性。可以為相同 OID 或不同 OID 增加不同類型的搜尋。


然後必須執行位於 serverroot/slapd-instance 之下的 db2index.pl 程序檔:

# perl db2index.pl -D "cn=Directory Manager" -w \ 
secret -n userRoot -t cn

此作業在線上執行,且需要花費一段時間才能完成。 也可選擇重新初始化字尾。請參閱「Sun Java System Directory Server 5 2005Q1 Administration Guide」中的「Reinitializing a Suffix」。

主控台還可用於增加 nsMatchingRule (請參閱「Sun Java System Directory Server 5 2005Q1 Administration Guide」中的「Managing Indexes」小節)。

在以下小節中,提供了需要修改的索引清單。請確保未執行任何非索引搜尋。這可以透過查看 Directory Server 存取記錄檔 (並在搜尋結果項目中查找 notes=U) 來完成。

在 Communications Express 中設置搜尋篩選器

需要變更 Communications Express 使用的搜尋篩選器以適應相符的規則語法。這可以透過啟用在 db_config.properties 檔案 (常駐在 deployed-path/WEB-INF/ldappstore [適用於個人儲存] 和 deployed-path/WEB-INF/corp-dir [適用於公司目錄]) 中指定的比較規則參數獲得。

這些參數為:

# Collation Rule
# Uncomment below to apply collation rule

# collation_rule=en-US

# Search Fields for which collation rule should be applied.
# The fields provided here should be disambiguator formatted fields
# e.g. entry/displayname, person/givenname etc.
# Uncomment below to supply the comma-separated fields

# search_fields=entry/displayname

取消註釋 collation_rulesearch_fields 參數以啟用比較規則。為在搜尋中指定獨立的一組欄位,請將 search_fields 變更為所需值。collation_rule 可以含有該語言相應的不具有指定搜尋類型字尾的語言標籤或 OID (範例中為 1.3.6.1.4.1.42.2.27.9.4.34.1)。變更後需要重新啟動 Web 容器實例。

應該在 LDAP Server 上為以下屬性建立索引以用於搜尋 Communications Express :