您可以擴充Adobe Experience Manager Assets搜尋功能。 Experience Manager資產現成可依字串搜尋資產。
搜尋是透過QueryBuilder介面完成,因此可以使用數個述詞自訂搜尋。 您可以在以下目錄中覆蓋預設謂詞集:/apps/dam/content/search/searchpanel/facets
。
您也可以將其他索引標籤新增至Experience Manager資產管理面板。
自Experience Manager 6.4起,已棄用傳統UI。 如需公告,請參閱已過時和已移除的功能。 建議您使用觸控式UI。 如需自訂項目,請參閱搜尋Facet。
若要覆蓋預先設定的述詞,請將facets
節點從/libs/dam/content/search/searchpanel
複製到/apps/dam/content/search/searchpanel/
,或在searchpanel配置中指定其他facetURL
屬性(預設為/libs/dam/content/search/searchpanel/facets.overlay.infinity.json
)。
預設情況下,/ apps
下的目錄結構不存在,需要建立。 請確定節點類型與/ libs
底下的節點類型相符。
您可以在「Experience Manager資產管理」中設定其他「搜尋」標籤,以新增這些標籤。 要建立其他頁簽:
如果資料夾結構/apps/wcm/core/content/damadmin/tabs,
尚未存在,請建立它,然後從/libs/wcm/core/content/damadmin
複製tabs
節點並貼上它。
視需要建立並設定第二個標籤。
建立第二個Siteadminsearchpanel時,請務必設定id
屬性,以防止表單衝突。
Experience Manager 資產隨附一組預先定義的述詞,可用來自訂「資產共用」頁面。以此方式自訂資產共用在建立和設定資產共用頁面中。
除了使用預先存在的謂語外,Experience Manager開發人員也可使用查詢產生器API建立自己的謂語。
建立自定義謂詞需要有關Widget框架的基本知識。
最佳實務是複製現有的述詞並加以調整。 示例謂語位於/libs/cq/search/components/predicates
中。
若要建立屬性述詞:
在項目目錄中建立元件資料夾,例如/apps/geometrixx/components/titlepredicate
。
新增 content.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="https://sling.apache.org/jcr/sling/1.0"
xmlns:cq="https://www.day.com/jcr/cq/1.0"
xmlns:jcr="https://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Title Predicate"
sling:resourceSuperType="foundation/components/parbase"
allowedParents="[*/parsys]"
componentGroup="Search"/>
新增 titlepredicate.jsp
.
<%--
Sample title predicate component
--%><%@ page import="java.util.Calendar" %><%
%><%@include file="/libs/foundation/global.jsp"%><%
// A unique id is necessary in case this predicate is inserted multiple times on the same page
String elemId = "cq-predicate-" + Long.toString(Calendar.getInstance().getTimeInMillis());
%><div class="predicatebox">
<div class="title">Title</div>
<%-- The wrapper for the form elements. All items will be append to this wrapper. --%>
<div id="<%= elemId %>" class="content"></div>
</div><script type="text/javascript">
CQ.Ext.onLoad(function() {
var predicateName = "property";
var propertyName = "jcr:content/metadata/dc:title";
var elemId = "<%= elemId %>";
// Get the page wide available QueryBuilder.
var qb = CQ.search.Util.getQueryBuilder();
// createId adds a counter to the predicate name - useful in case this predicate
// is inserted multiple times on the same page.
var id = qb.createId(predicateName);
// Hidden field that defines the property to search for; in our case this
// is the "dc:title" metadata. The name "property" (or "1_property", "2_property" etc.)
// indicates the server to use the property predicate
// (com.day.cq.search.eval.JcrPropertyPredicateEvaluator).
qb.addField({
"xtype": "hidden",
"renderTo": elemId,
"name": id,
"value": propertyName
});
// The visible text field. The name has to be like the one of the hidden field above
// plus the ".value" suffix.
qb.addField({
"xtype": "textfield",
"renderTo": elemId,
"name": id + ".value"
});
// Depending on the predicate additional parameters allow to configure the
// predicate. Here we add an operation parameter to create a "like" query.
// Again note the name set to the id and a suffix.
qb.addField({
"xtype": "hidden",
"renderTo": elemId,
"name": id + ".operation",
"value": "like"
});
});
</script>
若要讓元件可用,您必須能夠加以編輯。要使元件可編輯,請在CRXDE中添加主類型cq:EditConfig
的節點cq:editConfig
。 為了能夠移除段落,請新增多值屬性 cq:actions
,其中單一值 為DELETE。
導覽至您的瀏覽器,並在範例頁面(例如press.html
)上切換至設計模式,並啟用謂語段落系統的新元件(例如left)。
在Edit模式中,新元件現在可在sidekick中使用(可在Search群組中找到)。 將元件插入謂詞列中並鍵入搜索詞,例如菱形,然後按一下放大鏡以開始搜索。
搜尋時,請務必準確輸入詞語,包括正確的大小寫。
若要建立群組述詞:
在項目目錄中建立元件資料夾,例如/apps/geometrixx/components/picspredicate
。
新增 content.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="https://sling.apache.org/jcr/sling/1.0"
xmlns:cq="https://www.day.com/jcr/cq/1.0"
xmlns:jcr="https://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Component"
jcr:title="Image Formats"
sling:resourceSuperType="foundation/components/parbase"
allowedParents="[*/parsys]"
componentGroup="Search"/>
新增 titlepredicate.jsp
:
<%--
Sample group predicate component
--%><%@ page import="java.util.Calendar" %><%
%><%@include file="/libs/foundation/global.jsp"%><%
// A unique id is necessary in case this predicate is inserted multiple times on the same page.
String elemId = "cq-predicate-" + Long.toString(Calendar.getInstance().getTimeInMillis());
%><div class="predicatebox">
<div class="title">Image Formats</div>
<%-- The wrapper for the form elements. All items will be append to this wrapper. --%>
<div id="<%= elemId %>" class="content"></div>
</div><script type="text/javascript">
CQ.Ext.onLoad(function() {
var predicateName = "property";
var propertyName = "jcr:content/metadata/dc:format";
var elemId = "<%= elemId %>";
// Get the page wide available QueryBuilder.
var qb = CQ.search.Util.getQueryBuilder();
// Create a unique group ID; will return e.g. "1_group".
var groupId = qb.createGroupId();
// Hidden field that defines the property to search for - in our case "dc:format" -
// and declares the group of predicates. "property" in the name ("1_group.property")
// indicates to the server to use the "property predicate"
// (com.day.cq.search.eval.JcrPropertyPredicateEvaluator).
qb.addField({
"xtype": "hidden",
"renderTo": "<%= elemId %>",
"name": groupId + "." + predicateName, // 1_group.property
"value": propertyName
});
// Declare to combine the multiple values using OR.
qb.add(new CQ.Ext.form.Hidden({
"name": groupId + ".p.or", // 1_group.p.or
"value": "true"
}));
// The options
var options = [
{ "label":"JPEG", "value":"image/jpeg"},
{ "label":"PNG", "value":"image/png" },
{ "label":"GIF", "value":"image/gif" }
];
// Build a checkbox for each option.
for (var i = 0; i < options.length; i++) {
qb.addField({
"xtype": "checkbox",
"renderTo": "<%= elemId %>",
// 1_group.property.0_value, 1_group.property.1_value etc.
"name": groupId + "." + predicateName + "." + i + "_value",
"inputValue": options[i].value,
"boxLabel": options[i].label,
"listeners": {
"check": function() {
// Submit the search form when checking/unchecking a checkbox.
qb.submit();
}
}
});
}
});
若要讓元件可用,您必須能夠加以編輯。要使元件可編輯,請在CRXDE中添加主類型cq:EditConfig
的節點cq:editConfig
。 為了能夠移除段落,請新增多值屬性 cq:actions
,其中單一值 DELETE
為。
導覽至您的瀏覽器,並在範例頁面(例如press.html
)上切換至設計模式,並啟用謂語段落系統的新元件(例如left)。
在Edit模式中,新元件現在可在sidekick中使用(可在Search群組中找到)。 在謂詞列中插入元件。
下列述詞可作為預先設定的ExtJS介面工具集使用。
屬性 | 類型 | 說明 |
---|---|---|
predicateName | 字串 | 述詞的名稱。 預設為 fulltext |
searchCallback | 函數 | 用於觸發事件keyup 上的搜索的回調。 預設為 CQ.wcm.SiteAdmin.doSearch |
屬性 | 類型 | 說明 |
---|---|---|
predicateName | 字串 | 述詞的名稱。 預設為 property |
propertyName | 字串 | JCR屬性的名稱。 預設為 jcr:title |
defaultValue | 字串 | 預填的預設值。 |
屬性 | 類型 | 說明 |
---|---|---|
predicateName | 字串 | 述詞的名稱。 預設為 path |
rootPath | 字串 | 謂語的根路徑。 預設為 /content/dam |
pathFieldPredicateName | 字串 | 預設為 folder |
showFlatOption | 布林值 (Boolean) | 顯示複選框search in subfolders 的標籤。 預設為true。 |
屬性 | 類型 | 說明 |
---|---|---|
predicateName | 字串 | 述詞的名稱。 預設為 daterange |
屬性名稱 | 字串 | JCR屬性的名稱。 預設為 jcr:content/jcr:lastModified |
defaultValue | 字串 | 預填的預設值 |
屬性 | 類型 | 說明 |
---|---|---|
標題 | 字串 | 新增額外的頂端標題 |
predicateName | 字串 | 述詞的名稱。 預設為 daterange |
屬性名稱 | 字串 | JCR屬性的名稱。 預設為 jcr:content/metadata/cq:tags |
崩潰 | 字串 | 折疊級別。 預設為 level1 |
triggerSearch | 布林值 (Boolean) | 用於在檢查時觸發搜索的標籤。 預設為false |
searchCallback | 函數 | 觸發搜尋的回呼。 預設為 CQ.wcm.SiteAdmin.doSearch |
searchTimeoutTime | 數量 | 觸發searchCallback前的逾時。 預設為800毫秒 |
在「資產共用」頁面上呈現搜尋結果的方式由選取的鏡頭控制。 Experience Manager 資產隨附一組預先定義的鏡頭,可用來自訂「資產共用」頁面。以此方式自訂資產共用在建立和設定資產共用頁面中。
除了使用預先存在的鏡片外,Experience Manager開發人員也可以自行建立鏡片。