Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 ASP Presentation of free text search

Author  Topic 

Sitka
Aged Yak Warrior

571 Posts

Posted - 2003-08-29 : 14:34:26
I don't know if the Subject is correct but I'm sure many have seen what I'm talking about in Forums such as these. A user searches for something in the message body and the SQL returns a large varchar() or text() datatype from a LIKE query. How do you highlight the string searched for when displaying the result. Must be a canned function out there somewhere

Voted best SQL forum nickname...."Tutorial-D"

MichaelP
Jedi Yak

2489 Posts

Posted - 2003-08-29 : 14:38:51
Well on the ASP side, you could use Replace() to handle it. Something like this:


Response.write Replace(oRs("MyBigField"), mySearchTerm, "<B>" & mySearchTerm & "</B>")



What you'll need to do is get an array of your keywords and loop through that array and replace the keywords with highlighted keywords.

Does that make sense?

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page

Sitka
Aged Yak Warrior

571 Posts

Posted - 2003-08-29 : 15:37:05
Thanks,
of course it makes sense.
Canned function like duh REPLACE()
Hooo Hoo Hooo Haaa.
I'm laughing at myself here

Freaking, some days....man. I even took a drive to clear my head. Right in the middle of after lunches session, couldn't focus on nothing. Think because the IT guys get pizza on Friday my blood sugar goes way up then comes crashing down. Getting productive now though, everything seems kind of effortless and lightheaded, just the way I like it.

Again thanks

Voted best SQL forum nickname...."Tutorial-D"
Go to Top of Page
   

- Advertisement -