Search Result Title Changing the length

 The title of the search result is always getting limited to some characters. And it is limited by the display templates under Gallery section. "Item_CommonItem_Body.html". And the maximum no of characters is set by the field maxTitleLengthInChars.
 
The  code corresponds to that is shown below:
 
var titleHtml = String.format('<a clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>', $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));
 
So in order to show the entire title ,the code has to be tweaked like
 
clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{6}</a>', $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), showHoverPanelCallback, appAttribs, title);
 
See the highlighted portion where trimming is removed based on maxTitleLengthInChars.
 
Ebook Download
View all
Learn
View all