In Techno
I was trying to include the “created date” property in each faceted search result. Initially I was trying to create a new widget similar to “AlfSearchResult”. After several attempts, I came to know that creating a new one leads to longer response time and a lot of redundant code.

Picture

So it’s better to extend the existing widget with the simple configuration options which are available in Aikau (aikau-1.0.34)
·        widgetsAbove
·        widgetsbelow
·        enableContextMenu
·        showMoreInfo
·        showSelectotor

Steps I followed to attain our result:

1.      Create an extension xml in alfresco/web-extension/site-data/search-results-extension.xml

<extension>
<modules>
<module>
<id>
Search Results extension</id>
<auto-deploy>
true</auto-deploy>
<evaluator
 type=“default.extensibility.evaluator”/>
<customizations>
<targetPackageRoot>
org.alfresco.share.pages.faceted-search</targetPackageRoot>
<sourcePackageRoot>
nl.contezza.pages.faceted-search</sourcePackageRoot>
</customization>
</customizations>
</module>
</modules>
</extension>

2.      Since the standard search result json response from the repository does not contain “created date” property, we included that in the freemarker template
alfresco\extension\templates\webscripts\org\alfresco\slingshot\search\search.get.json.ftl
3.      Create a extension xml in the alfresco/web-extension/site-data/search-results-extension.xml
4.      Create a faceted-search.get.js file under the extension path mentioned in the extension module.
5.      In faceted-search.get.js , search the id of the standard “AlfSearchResult” widget

var fctSearchRes = widgetUtils.findObject(model.jsonModel, "id", "FCTSRCH_SEARCH_RESULT");
6.      Now I used “widgetsBelow” option to include the created date of the document/folder in each search result
fctSearchRes.config.widgetsBelow = [{ 
        name: "alfresco/renderers/Date", 
        config: { 
                propertyToRender: "createdOn", 
                simple: true, 
                label: msg.get("label.created"), 
                renderSize: "medium" 
        } 
}]; 
Note: “createdOn” is the property that is inserted in the respository json template.
Picture
Recent Posts

Start typing and press Enter to search