2

I am using Sharepoint 2013 and sharepoint 2013 search.

when i search for certain items i get results, but the title of certain items shows with a trailing dots after showing some characters of the title and truncating the rest.

For example: let the title be "This is a sample title just for testing" and in the search result the title is shown as "This is a sample title just....". So aftre displaying some part of the title it is showing ... I need to hover over the item to see the full title.Is there any option to show the full title.

2

I tried as told by Sane.Amit. But still i am getting the same result.

Because it is already trimmed in the display template.

So i updated the display template Item_CommonItem_Body.

I replaced the below portion

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));

with the below code

var titleHtml = String.format('<a clicktype="{0}" id="{1}" href="{2}" class="ms-srch-item-link" title="{3}" onfocus="{4}" {5}>{3}</a>',
                                          $htmlEncode(clickType), $htmlEncode(id + Srch.U.Ids.titleLink), $urlHtmlEncode(url), $htmlEncode(ctx.CurrentItem.Title), 
                                          showHoverPanelCallback, appAttribs, Srch.U.trimTitle(title, maxTitleLengthInChars, termsToUse));

This brought the full title but in single line.

Now i changed the CSS with the below change:

.ms-srch-ellipsis
{
/*white-space:nowrap;*/
overflow:hidden;
text-overflow:ellipsis;
-ms-text-overflow:ellipsis;
}

Now it worked nicely as expected.

0

The title of each search result is governed by the css associated with .ms-srch-ellipsis class.

.ms-srch-ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

Due to the text-overflow property being set to ellipsis you are seeing the title followed by a few dots. I think it is better to keep it this way around. And in case you wish to change it, you can remove ellipsis attribute and also you can add width attribute for this class.

0

Yes you can use $htmlEncode(ctx.CurrentItem.Title) which shows original title, instead of highlighted title. However with this approach your titles won’t be highlighted anymore. You probably need to add some extra logic to keep highlighted functionality.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.