Hello,
our Content Types have technical names and a human "readable" description. However, the content type refiner in search displays only the technical name.
Therefore we implemented an own filter_default.html. We added following code to filter_default.html and renamed it to my_filter_default.html.
function setContentTypeDesc() {
ctArray['AKBX_FAQ'] = ' FAQ Tipps & Tricks';
ctArray['AKBX_DWL'] = ' Downloads';
ctArray['AKBX_AIP'] = ' Application Ideas Pool';
ctArray['AKBX_AUT'] = ' Automation Software';
ctArray['AKBX_RNO'] = ' Release Notes';
ctArray['AKBX_VSH'] = ' Versions Histories';
ctArray['AKB_GLO'] = ' Glossary';
ctArray['AKB_EFS'] = ' Success Stories';
ctArray['VPS_APA'] = ' Application Topical';
ctArray['VPS_APB'] = ' Application Report';
ctArray['VPS_MAA'] = ' Marketing Topical';
ctArray['VPS_SAA'] = ' Sales Topical';
ctArray['VPS_SEM'] = ' Service Messages';
ctArray['VPS_SEA'] = ' Service Topical';
ctArray['DS_DSD'] = ' Drive solution designer';
ctArray['DS_NM'] = ' Nonlinear mechanics';
ctArray['DS_DB'] = ' Drives Basics';
ctArray['DS_EASY'] = ' Easy Explorer';
ctArray['DS_EE'] = ' Energyefficiency';
ctArray['DS_DSC'] = ' Drive Solution Catalogue';
ctArray['DS_EP'] = ' Excel programs';
ctArray['TD_HWI'] = ' Mounting Instructions';
ctArray['TD_OPI'] = ' Operating Instructions';
ctArray['TD_D_Lenze'] = ' Lenze declaration';
ctArray['TD_SYM'] = ' System Manual';
ctArray['TD_COM'] = ' Communication Manual';
ctArray['TD_D_EC'] = ' EC declaration';
ctArray['TD_IMO'] = ' Information for the operator of the machine';
ctArray['TD_C_UL'] = ' UL certificate of compliance';
ctArray['TD_SWR'] = ' Reference Manual';
ctArray['TD_HWM'] = ' Hardware Manual';
ctArray['TD_SWM'] = ' Software Manual';
ctArray['TD_D_EAC'] = ' EAC declaration';
ctArray['TD_C_UkrSEPRO'] = ' UkrSEPRO certificate';
ctArray['TD_C_CCC'] = ' CCC certificate';
ctArray['TD_C_COM'] = ' Industrial communication certificate';
ctArray['TD_C_Safety'] = ' Safety engineering certificate';
ctArray['TD_C_Environment'] = ' Environmental management certificate';
ctArray['TD_C_Quality'] = ' Quality management certificate';
ctArray['TD_EPLAN'] = ' EPLAN P8 macros';
ctArray['TD_C_ECE'] = ' ECE certificate';
isCTDescSet = true;
}
function getContentTypeDesc(key) {
if (ctArray != undefined && ctArray != null){
return ctArray[key];
}
}
............
else if (hasControl && !$isNull(listData))
{
for(var i in listData)
{
if(isCTDescSet == false){
setContentTypeDesc();
}
hasCTDesc = getContentTypeDesc(listData[i].RefinementName);
if (hasCTDesc != undefined && hasCTDesc != null){
if(listData.length == 1) {
listData[0].RefinementName = hasCTDesc;
listData[0].RefinementTokens = [listData[0].RefinementToken];
listData[0].RefinementTokenWrappedValues = [Srch.RefinementUtil.stringValueToEqualsToken(listData[0].RefinementValue)];
if(ctx.RefinementControl.propertyName == "MediaDuration")
{
Srch.U.modifyMediaDurationRefinementName(listData[0]);
}
}
else {
listData[i].RefinementName = hasCTDesc;
listData[i].RefinementTokens = [listData[i].RefinementToken];
listData[i].RefinementTokenWrappedValues = [Srch.RefinementUtil.stringValueToEqualsToken(listData[i].RefinementValue)];
if(ctx.RefinementControl.propertyName == "MediaDuration")
{
Srch.U.modifyMediaDurationRefinementName(listData[i]);
}
}
}
}
}
this is working but not optimal, because you have to edit the filter file for every new content type, its not multi language etc. We tried to get description by CSOM but it seems that this is not allowed it display templates.
Any ideas how to dynamically get the content type descriptions for the refiner? If there is no way by CSOM (maybe also not good because of performance issues), can we place the array into a separate file and make it browser language aware?
Greetings, Jrg