RE: highlight MULTIPLE keywords in search results...
I can't belive that I, of all people, missed a chance to use a regex. I bow my head in shame. This just goes to show that expanding your mind is a bad thing. Back to the straigt and narrowminded for me. The only thing that I would do differently is add apostrophes, hyphens, and underscores to the allowed characters and replace multiple spaces with a single pipe to avoid issues there: terms = REReplaceNoCase(terms, "[^a-z_-]+"," ","All"); terms = Replace(terms, " +","|","All"); -- Ben Doom Programmer & General Lackey Moonbow Software, Inc : -Original Message- : From: Jochem van Dieten [mailto:[EMAIL PROTECTED]] : Sent: Monday, February 17, 2003 4:54 PM : To: CF-Talk : Subject: Re: highlight MULTIPLE keywords in search results... : : : Tuan wrote: : > Can somebody provide me with an example of how to highlight : multiple keywords in a search result? For example say I wanted to : search for "macromedia coldfusion, studio" the search results : will highlight every instance of "macromedia", "coldfusion", and : "studio" in the document. : : 2 step process. First clean up yuor search string, probably best done by : replacing all non-alphabetic characters with spaces, then dumping all : the 1 char searchstrings (presuming English). The run a replace with : what is left (no loop necessary if you use a regex). Pseudocode: : : //cleanup: : terms = REReplaceNoCase(terms, "[^a-z]+"," ","All"); : terms = REReplaceNoCase(terms, "^[a-z] | [a-z] | [a-z]$"," ","All"); : : //highlight : terms = Replace(terms, " ","|","All"); : text = REReplaceNoCase(text,"(#terms#)","\1","All"); : : Jochem : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: highlight MULTIPLE keywords in search results...
Tuan wrote: > Can somebody provide me with an example of how to highlight multiple keywords in a >search result? For example say I wanted to search for "macromedia coldfusion, studio" >the search results will highlight every instance of "macromedia", "coldfusion", and >"studio" in the document. 2 step process. First clean up yuor search string, probably best done by replacing all non-alphabetic characters with spaces, then dumping all the 1 char searchstrings (presuming English). The run a replace with what is left (no loop necessary if you use a regex). Pseudocode: //cleanup: terms = REReplaceNoCase(terms, "[^a-z]+"," ","All"); terms = REReplaceNoCase(terms, "^[a-z] | [a-z] | [a-z]$"," ","All"); //highlight terms = Replace(terms, " ","|","All"); text = REReplaceNoCase(text,"(#terms#)","\1","All"); Jochem ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: highlight MULTIPLE keywords in search results...
It was recently discussed on the list how to hightlight keywords in a document. For this, simply run the process once for each keyword in the list of keywords. The hard part, it seems to me, would be to clean user-created inputs before referencing them as a list per se. So if we have two functions cleanlist() and highlightword() we might do: cleanlist(keywordlist); for (i = 1; i <= listlen(keywordlist); i = i+1) { highlightword(document, listgetat(keywordlist, i)); } HTH. -- Ben Doom Programmer & General Lackey Moonbow Software, Inc : -Original Message- : From: Tuan [mailto:[EMAIL PROTECTED]] : Sent: Monday, February 17, 2003 3:43 PM : To: CF-Talk : Subject: highlight MULTIPLE keywords in search results... : : : Can somebody provide me with an example of how to highlight : multiple keywords in a search result? For example say I wanted to : search for "macromedia coldfusion, studio" the search results : will highlight every instance of "macromedia", "coldfusion", and : "studio" in the document. : : : : ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: highlight MULTIPLE keywords in search results...
Right now you search your document and highlight a specific keyword. Just put that process in a loop and loop over the keywords: #keyword", "all") /> HTH, barneyb > -Original Message- > From: Tuan [mailto:[EMAIL PROTECTED]] > Sent: Monday, February 17, 2003 12:43 PM > To: CF-Talk > Subject: highlight MULTIPLE keywords in search results... > > > Can somebody provide me with an example of how to highlight > multiple keywords in a search result? For example say I wanted to > search for "macromedia coldfusion, studio" the search results > will highlight every instance of "macromedia", "coldfusion", and > "studio" in the document. > > > > ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
highlight MULTIPLE keywords in search results...
Can somebody provide me with an example of how to highlight multiple keywords in a search result? For example say I wanted to search for "macromedia coldfusion, studio" the search results will highlight every instance of "macromedia", "coldfusion", and "studio" in the document. ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4