Servigistics InService 發佈與載入 > 其他資訊 > TAL 自訂 > 新增新搜尋欄位
  
新增新搜尋欄位
Servigistics InService 具有下列兩種類型的搜尋欄位︰
辭彙欄位
全文字欄位
請遵循下列步驟來新增新搜尋欄位:
1. 如果所需搜尋欄位不存在於 Types/globalDefinitions.xml 檔案中,請在 globalDefinitions.xmlSearch Attributes 部份新增新項目以定義新搜尋欄位。
例如:
<SearchField Label="Region" Name="REGION" Length="20" Type="Term"/>
<SearchField Label="Load Date" Name="PubDate" Type="Date"/>
<SearchField Name="FULLTEXT_PARTNAME">
如果您要新增日期的搜尋欄位,存放庫中的所需格式為︰YYYYMMDD,例如 20150729。請注意,如果輸入文件有其他一些日期格式,您必須有用於將輸入格式轉換為所需格式的 XSL 程式碼。
2. 如果所需搜尋欄位不存在於類型內容中,請在感興趣的類型中新增新定義的搜尋欄位。
例如,針對 XML 結構中的下列輸入資料︰
<Object>
<region>IN</region>
</Object>
您可以新增下列搜尋欄位︰
<SearchField Name="REGION">
<FieldMapping TemplateID="ResultField_TYPENAME_Attribute " XPath=" Object ">
<xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform" Type=" XPath">
<xsl:value-of select="region"/>
</xsl:template>
</FieldMapping>
</SearchField>
<SearchField Name="FULLTEXT_REGION ">
<FullTextMapping XPath="region"/>
</SearchField>
3. 如果已經載入資料,請重新索引新資產的資料。否則,請遵循正常的資料載入流程。
Servigistics InService 介面全域搜尋通常會根據針對個別類型定義的 FULLTEXT 搜尋欄位傳回結果。如果您要將其他屬性新增至現有全域搜尋,必須包括來源 XML 中所需屬性或元素的 XPATH 作為 FullTextMapping 元素。
例如,假設您擁有企業物件 Part 的下列來源 XML
<Part>
<partName>MY PART</partName>
<partNumber>PRT000012121</partNumber>
</Part>
<!--
As per following type definition of above source xml, you can only
search this Part through partName(that is MY PART) only. Not through
partNumber(PRT000012121)
-->
<SearchField Name="FULLTEXT_PARTNAME">
<FullTextMapping XPath="Part/partName"/>
</SearchField>
<!--
If you want to search based on partNumber then you must update the type
defintion for Part Object. And in type definition file, you must add xpath for
partNumber (Part/partNumber) in search field
mapping as defined below.
-->
<SearchField Name="FULLTEXT">
<FullTextMapping XPath="Part/partName"/>
<FullTextMapping XPath="Part/partNumber"/>
</SearchField>
請記住,您可以藉由將根元素 (*/*) 作為其完整文字搜尋條件的 XPATH 進行傳遞,來將完整來源 XML 指定為全域搜尋的一部份。例如:
<SearchField Name="FULLTEXT">
<FullTextMapping XPath="*/*"/>
</SearchField>