Re: modifying results
From: Jeff Cochran (jeff.nospam_at_zina.com)
Date: 07/10/04
- Next message: Chris Hohmann: "Re: stripping HTML tags"
- Previous message: shank: "modifying results"
- In reply to: shank: "modifying results"
- Next in thread: David C. Holley: "Re: modifying results"
- Reply: David C. Holley: "Re: modifying results"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 10 Jul 2004 20:37:23 GMT
On Sat, 10 Jul 2004 16:13:13 -0400, "shank" <shank@tampabay.rr.com>
wrote:
>The SQL newsgroup sent me here....
>Using the following query I get my desired results. However, in the
>resulting recordset, how can I show for example 10 words before and 10 words
>after the keyword or phrase that was searched upon? If I get 20 resulting
>records I think it would be easier for the user to decide which they want to
>view. Google does this.
>thanks
>
>DECLARE @SearchString varchar(100)
>SET @SearchString = ' "stress" '
>SELECT KEY_TBL.RANK, Title, Body
>FROM Articles INNER JOIN
> FREETEXTTABLE(Articles,*, @SearchString) AS KEY_TBL
> ON Articles.ID = KEY_TBL.[KEY]
>ORDER BY Rank DESC
You'll need to retrieve the article body, parse it to find the word
searched for, then parse out the ten words before and after that one
to formulate the display. There are any number of utilities that
already do this if you're looking for a canned package, but there
isn't (that I've seen) a way to retrieve only that group of words.
Naturally, you'll have difficulty with the article that has the line:
"Stress can cause distress in the stressed individual and his
mistress, seamstress and any distressed person."
:)
Jeff
- Next message: Chris Hohmann: "Re: stripping HTML tags"
- Previous message: shank: "modifying results"
- In reply to: shank: "modifying results"
- Next in thread: David C. Holley: "Re: modifying results"
- Reply: David C. Holley: "Re: modifying results"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|