AnsweredAssumed Answered

adding custom attribute to search results with Aikau / Alfresco 5.2

Question asked by dbiggins on Apr 13, 2017
Latest reply on Apr 19, 2017 by dbiggins

I am able to customize the search result list in alfresco 5.2 with Aikau by adding the following to a Share Amp:

 - create src/main/amp/config/alfresco/web-extension/site-data/extensions/search-results-extension.xml

<extension>
    <modules>
        <module>
            <id>Search Results Add Created Date</id>
            <auto-deploy>true</auto-deploy>
            <customizations>
                <customization>
                    <targetPackageRoot>org.alfresco.share.pages.faceted-search</targetPackageRoot>
                    <sourcePackageRoot>com.mine.content.alfresco.pages.faceted-search</sourcePackageRoot>
                </customization>
            </customizations>
        </module>
    </modules>
</extension>

 

 - create /src/main/amp/config/alfresco/web-extension/site-webscripts/com/mine/content/alfresco/pages/faceted-search/faceted-search.get.js

 

var fctSearchRes = widgetUtils.findObject(model.jsonModel.widgets, "id", "FCTSRCH_SEARCH_RESULT");

 

fctSearchRes.config.widgetsBelow = [{
        name: "alfresco/renderers/Date",
        config: {
                propertyToRender: "created",
                simple: true,
                label: msg.get("label.created"),
                renderSize: "medium"
        }
}];

 

This places the value created date at the bottom of the attributes listed in the search result elements.

 

If i want to include a custom attribute, I assume that i will need to explicitly include it as part of the item in the search result, though I am not sure if the changes to 5.2 make all of the items attributes available, or whether I need to override / extend search.get.json.ftl.  In either case, I am unable to get my custom attribute  to show up in the result list.

 

Any thoughts on how to get this to work?

Thanks!

Outcomes