Creating search results
I am trying to make a search display page that will display a snippet of text (about 300 characters) from blog posts that match the search criterion. I have no problem with generating the results, but I would like to be able to zero in on the actual search term within the returned query. So, if I have a blog post of 12,000 characters, I would like to be able to select 300 characters from that post that contain the search term (ex. atonement). I was thinking that the answer might have something to do with a combination of #Right()# and #Left()#, but I'm not particularly sure how to pull it off. Thanks! Joel ~| Create Web Applications With ColdFusion MX7 Flex 2. Build powerful, scalable RIAs. Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJS Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276479 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
RE: Creating search results
Something like mid() should do it. Just start like 150 characters to the left of where you find the term (if there are 150 characters to the left) And do the same thing for the end... 150 characters to the right of the found term. find() will give you the position of the term in the text. find() - 150 would be the starting point. find() + 150 would give the end point. Youll probably need to double check and make sure there are 150 characters to the left of the found term though, I think a negative number may throw an error with mid... not sure though. So if find()-150 gte 1 use it, else use 1 as the starting point and 300 as the end point. -Original Message- From: Joel Watson [mailto:[EMAIL PROTECTED] Sent: Saturday, April 28, 2007 11:21 AM To: CF-Talk Subject: Creating search results I am trying to make a search display page that will display a snippet of text (about 300 characters) from blog posts that match the search criterion. I have no problem with generating the results, but I would like to be able to zero in on the actual search term within the returned query. So, if I have a blog post of 12,000 characters, I would like to be able to select 300 characters from that post that contain the search term (ex. atonement). I was thinking that the answer might have something to do with a combination of #Right()# and #Left()#, but I'm not particularly sure how to pull it off. Thanks! Joel ~| ColdFusion MX7 by AdobeĀ® Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276482 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Creating search results
On 4/28/07, Joel Watson [EMAIL PROTECTED] wrote: I am trying to make a search display page that will display a snippet of text (about 300 characters) from blog posts that match the search criterion. I have no problem with generating the results, but I would like to be able to zero in on the actual search term within the returned query. Although you can probably do a lot of work to make this work manually, it'd probably be a WHOLE lot easier if you used Verity. Rick ~| Upgrade to Adobe ColdFusion MX7 The most significant release in over 10 years. Upgrade see new features. http://www.adobe.com/products/coldfusion?sdid=RVJR Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276488 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4