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. I know Google does this. Is this an SQL issue or ASP issue?
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
string handling is more efficiently done on the client level as opposed to
within SQL Server.
"shank" <shank@.tampabay.rr.com> wrote in message
news:Obj%23ddqZEHA.1508@.TK2MSFTNGP09.phx.gbl...
> 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. I know Google does this. Is this an SQL issue or ASP issue?
> 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
>
|||Hilary,
While in some cases, client-side process might be better, for example
client-side paging and sorting of results, however, in this case, I must
respectively disagree...
Shank, you can use Substring and PatIndex along with your FREETEXTTABLE
query and get the "Goggle like" results that you have requested.
Specifically, the following SQL FTS query on the pubs table pub_info will
return rows that match the FTS search word (books) and display the near by
words from 20 characters before the searched keyword(books) for a total
length of 100 characters.
SELECT pub_id, SubString(pr_info,PatIndex ('%books%',pr_info)-20,100)
FROM pub_info
WHERE Contains(pr_info, 'books')
Regards,
John
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:#eM2eLrZEHA.644@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
> string handling is more efficiently done on the client level as opposed to
> within SQL Server.
>
> "shank" <shank@.tampabay.rr.com> wrote in message
> news:Obj%23ddqZEHA.1508@.TK2MSFTNGP09.phx.gbl...
> words
resulting[vbcol=seagreen]
want
> to
>
|||I really don't think so. In fact I know so. You can easily demonstrate this
within vbscript.
In fact I have written and ISAPI extension that does this - and posted it
here. Thinking about doing it within a database is simply not a good choice.
"John Kane" <jt-kane@.comcast.net> wrote in message
news:%2364LxM9ZEHA.2792@.TK2MSFTNGP09.phx.gbl...[vbcol=seagreen]
> Hilary,
> While in some cases, client-side process might be better, for example
> client-side paging and sorting of results, however, in this case, I must
> respectively disagree...
> Shank, you can use Substring and PatIndex along with your FREETEXTTABLE
> query and get the "Goggle like" results that you have requested.
> Specifically, the following SQL FTS query on the pubs table pub_info will
> return rows that match the FTS search word (books) and display the near by
> words from 20 characters before the searched keyword(books) for a total
> length of 100 characters.
> SELECT pub_id, SubString(pr_info,PatIndex ('%books%',pr_info)-20,100)
> FROM pub_info
> WHERE Contains(pr_info, 'books')
> Regards,
> John
>
> "Hilary Cotter" <hilaryk@.att.net> wrote in message
> news:#eM2eLrZEHA.644@.tk2msftngp13.phx.gbl...
to
> resulting
> want
>
|||Hi Hilary,
Then I guess we can agree that we disagree <G>, as I did say in " some
cases" and not in all cases, so we can agree, on a case-by-case basis. Are
you saying that in all cases, that all types of "string handling" are "bad"
if handled on the server-side?
Regards,
John
"Hilary Cotter" <hilaryk@.att.net> wrote in message
news:ue$hecFaEHA.2844@.TK2MSFTNGP12.phx.gbl...
> I really don't think so. In fact I know so. You can easily demonstrate
this
> within vbscript.
> In fact I have written and ISAPI extension that does this - and posted it
> here. Thinking about doing it within a database is simply not a good
choice.[vbcol=seagreen]
> "John Kane" <jt-kane@.comcast.net> wrote in message
> news:%2364LxM9ZEHA.2792@.TK2MSFTNGP09.phx.gbl...
will[vbcol=seagreen]
by[vbcol=seagreen]
opposed[vbcol=seagreen]
> to
10
>
No comments:
Post a Comment