ConvincingMail - Email Marketing SoftwareConvincingMail
 
Email Marketing Software

Welcome Guest Search | Active Topics | Members | Log In | Register

Highlighting of found search terms Options · View
pherbio
Posted: Wednesday, February 11, 2009 12:35:19 PM
Rank: Newbie
Groups: Member

Joined: 2/11/2009
Posts: 1
Points: 3
How do I change the highlighting of searched text?

example:

Search: or
Return: North Dakota

Right now, it only will highlight the term if it if begins with the search text.

Also, how would I highlight multiple search text?

example:

Search: or ta
Return: North Dakota

Edit: I've already got the query changed to return the proper results, so I don't need help with the query, just the modification on the highlighting.
trooper
Posted: Wednesday, February 11, 2009 1:40:12 PM
Rank: Administration
Groups: Administration

Joined: 11/18/2007
Posts: 80
Points: 152
Hi,
All you need is to wrap text you want to hilight with <span class="hilighted">text to hilight<span>
here is the common code from SuggestionTools.cs class.

Code:
public static string HighLight(string text, string value)
       {
           Regex regex = new Regex("\\s(" + value + ")|^(" + value + ")",
                                   RegexOptions.Compiled | RegexOptions.IgnoreCase);
           return regex.Replace(text, new MatchEvaluator(MatchEval));
       }

private static string MatchEval(Match match) {
     return "<span class=\"hilighted\">" + match + "</span>";
}


Hope this helps
Thanks.
Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.1.8 (NET v2.0) - 3/29/2008
Copyright © 2003-2008 Yet Another Forum.net. All rights reserved.
This page was generated in 0.041 seconds.