This article describes how to modify a default smart search result transformation so that its output will list words based on the results found.
If you need to list these words in your transformation, i.e. would like to get following result:
You can add the following code into your smart search transformation.
<script runat="server">
private string MyFunction(string text)
{
string result="";
System.Text.RegularExpressions.Regex exp = new Regex(
@"<([^>]+)>(.*?)</\1>", RegexOptions.IgnoreCase);
MatchCollection matchList = exp.Matches(text);
if ( matchList.Count!=0)
{
foreach (Match match in matchList)
{
result += " " + match.Value;
}
}
return result;
}
</script>
<p> This result is included in the results because of the search term: <%# MyFunction(CMS.SiteProvider.SearchHelper.Highlight(CMS.GlobalHelper.HTMLHelper.HTMLEncode(CMS.ExtendedControls.ControlsHelper.RemoveDynamicControls(DataHelper.GetNotEmpty(Eval("Title"), "/"))),"<b>","</b>"))%></p>
-it-