Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > SearchDialogWithResults Transformation View modes: 
User avatar
Member
Member
sabrina.cameron-rogers - 12/23/2010 2:45:58 PM
   
SearchDialogWithResults Transformation
I am using Kentico version v5.5.3926.

I have built a Page template that uses multiple Document Types with the Repeater web part to create resumes. The template will be copied many times by users who will use create their resume and site visitors will use the search tool to find the type of resume they want to view.

I want the SearchDialogWithResults web part to search the Page content including searching the content in each Document Type of the Page. I want the search engine to return the matching Page not the Document Type.

I need help modifying the transformation code so that the search results display a link to the matching Page, not Document Type.

The transformation I am currently using is "CMS.Root.SmartSearchResultsWithImages" with the following default transformation code (sorry to drop so much code into my message...):


<div style="margin-bottom: 30px;">
<%-- Search result image --%>
<div style="float: left; border: solid 1px #eeeeee; width: 90px; height:90px; margin-right: 5px;">
<img src="<%# GetSearchImageUrl("~/App_Themes/Default/Images/CMSModules/CMS_SmartSearch/no_image.gif",90) %>" alt="" />
</div>
<div style="float: left">
<%-- Search result title --%>
<div>
<a style="font-weight: bold" href='<%# SearchResultUrl(true) %>'>
<%# SearchHighlight(HTMLHelper.HTMLEncode(DataHelper.GetNotEmpty(Eval("Title"), "/")),"<span style=\"font-weight:bold;\">","</span>") %>
</a>
</div>
<%-- Search result content --%>
<div style="margin-top: 5px; width: 590px;min-height:40px">
<%# SearchHighlight(HTMLHelper.HTMLEncode(TextHelper.LimitLength(HttpUtility.HtmlDecode(HTMLHelper.StripTags(GetSearchedContent(DataHelper.GetNotEmpty(Eval("Content"), "")), false, " ")), 280, "...")),"<span style=\"background-color: #FEFF8F\">","</span>") %><br />
</div>
<%-- Relevance, URL, Creattion --%>
<div style="margin-top: 5px;">
<%-- Relevance --%>
<div title="<%# "Relevance: " + Convert.ToInt32(ValidationHelper.GetDouble(Eval("Score"),0.0)*100) + "%" %>"
style="width: 50px; border: solid 1px #aaaaaa; margin-top: 7px; margin-right: 6px;
float: left; color: #0000ff; font-size: 2pt; line-height: 4px; height: 4px;">
<div style="<%# "background-color:#a7d3a7;width:"+ Convert.ToString(Convert.ToInt32((ValidationHelper.GetDouble(Eval("Score"),0.0)/2)*100)) + "px;height:4px;line-height: 4px;"%>">
</div>
</div>
<%-- URL --%>
<span style="color: #008000">
<%# TextHelper.BreakLine(SearchHighlight(SearchResultUrl(true),"<strong>","</strong>"),75,"<br />") %>
</div>
</div>
<div style="clear: both">
</div>
</div>

User avatar
Member
Member
kentico_michal - 12/28/2010 4:52:14 AM
   
RE:SearchDialogWithResults Transformation
Hi Sabrina,

Well, since you have transformation under control, you can modify it according to your needs. SearchResultURl returns the URL of the document, so if you want to genarate link to some other page, you will need to create the link manually. You can develop custom transformation method and generate links dynamically based on the information about current document from search results.

Best regards,
Michal Legen