Adding tabs

You can add additional Search tabs by configuring them in the Experience Manager Assets Admin. To create additional tabs:

  1. Create the folder structure /apps/wcm/core/content/damadmin/tabs,if it does not already exist, and copy the tabs node from /libs/wcm/core/content/damadmin and paste it.

  2. Create and configure the second tab, as desired.

    NOTE
    When you create a second siteadminsearchpanel, be sure to set an id property in order to prevent form conflicts.

Creating Custom Predicates

Experience Manager Assets comes with a set of predefined predicates that can be used to customize an Asset Share page. Customizing an Asset Share in this way is covered in Creating and Configuring an Asset Share Page.

In addition to using pre-existing predicates, Experience Manager developers can also create their own predicates using the Query Builder API.

Creating custom predicates requires basic knowledge about the Widgets framework.

The best practice is to copy an existing predicate and adjust it. Sample predicates are located in /libs/cq/search/components/predicates.

Example: Build a simple property predicate

To build a property predicate:

  1. Create a component folder in your projects directory, for example /apps/geometrixx/components/titlepredicate.

  2. Add 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"/>
    
  3. Add 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>
    
  4. To make the component available, you need to be able to edit it. To make a component editable, in CRXDE, add a node cq:editConfig of primary type cq:EditConfig. So that you can remove paragraphs, add a multi-value property cq:actions with a single value of DELETE.

  5. Navigate to your browser, and on your sample page (for example, press.html) switch to design mode and enable your new component for the predicate paragraph system (for example, left).

  6. In Edit mode, the new component is now available in the sidekick (found in the Search group). Insert the component in the Predicates column and type a search word, for example, Diamond and click the magnifying glass to start the search.

    NOTE
    When searching, be sure to type in the term exactly, including the correct case.

Example: Build a simple group predicate

To build a group predicate:

  1. Create a component folder in your projects directory, for example /apps/geometrixx/components/picspredicate.

  2. Add 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"/>
    
  3. Add 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();
                        }
                    }
                });
            }
    
        });
    
  4. To make the component available, you need to be able to edit it. To make a component editable, in CRXDE, add a node cq:editConfig of primary type cq:EditConfig. So that you can remove paragraphs, add a multi-value property cq:actions with a single value of DELETE.

  5. Navigate to your browser, and on your sample page (for example, press.html) switch to design mode and enable your new component for the predicate paragraph system (for example, left).

  6. In Edit mode, the new component is now available in the sidekick (found in the Search group). Insert the component in the Predicates column.

Installed Predicate Widgets

The following predicates are available as preconfigured ExtJS widgets.

FulltextPredicate

PropertyTypeDescription
predicateNameStringName of the predicate. Defaults to fulltext
searchCallbackFunctionCallback for triggering search on event keyup. Defaults to CQ.wcm.SiteAdmin.doSearch

PropertyPredicate

PropertyTypeDescription
predicateNameStringName of the predicate. Defaults to property
propertyNameStringName of the JCR property. Defaults to jcr:title
defaultValueStringPrefilled default value.

PathPredicate

PropertyTypeDescription
predicateNameStringName of the predicate. Defaults to path
rootPathStringRoot path of the predicate. Defaults to /content/dam
pathFieldPredicateNameStringDefaults to folder
showFlatOptionBooleanFlag to show Checkbox search in subfolders. Defaults to true.

DatePredicate

PropertyTypeDescription
predicateNameStringName of the predicate. Defaults to daterange
propertynameStringName of the JCR property. Defaults to jcr:content/jcr:lastModified
defaultValueStringPrefilled default value

OptionsPredicate

PropertyTypeDescription
titleStringAdds an additional top title
predicateNameStringName of the predicate. Defaults to daterange
propertynameStringName of the JCR property. Defaults to jcr:content/metadata/cq:tags
collapseStringCollapse level. Defaults to level1
triggerSearchBooleanFlag for triggering search on check. Defaults to false
searchCallbackFunctionCallback for triggering search. Defaults to CQ.wcm.SiteAdmin.doSearch
searchTimeoutTimeNumberTimeout before searchCallback is fired. Defaults to 800ms

Customizing Search Results

The presentation of search results on an Asset Share page is governed by the selected lens. Experience Manager Assets comes with a set of predefined lenses that can be used to customize an Asset Share page. Customizing an Asset Share in this way is covered in Creating and Configuring an Asset Share Page.

In addition to using pre-existing lenses, Experience Manager developers can also create their own lenses.

Experience Manager


The Perfect Blend: A New Era of Collaboration with AEM and Workfront

Adobe Customer Success Webinars

Wednesday, Apr 2, 5:00 PM UTC

Explore how Adobe Experience Manager and Workfront integrate to help teams move from ideation to delivery without the usual bottlenecks, ensuring content is organized, on-brand, and ready to go live faster.

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more