2012年3月27日星期二

Full Text Search: percentage match

I need to add a percentage "perfect match" for my search-action, for instance 50% perfect match if only one of the 2 searchexpressions were found. Full Text Search seems to perfect for the search-action, but how do I add this percentage to my select?

This may have a simple solution but I do not seem to be able to find it. Any help is greatly appreciated.

Vicky

You need to put each search expression in a different containstable() and aggregate over the union of the containstable results.

|||Thanks for the reply but can you give me a bit more information? How can this help to generate a percentage match for a search?|||

Say you want percentage match on "foo" and "bar".

select foo.[key],(IsNull(foo.fooExist, 0)+IsNull(bar.barExist,0))/ 2.0

from

(

(select [key], 1 as fooExist fromcontainstable(t1,*,'hello')) foo

fullouterjoin

(select [key], 1 as barExist fromcontainstable(t1,*,'bar')) bar

on foo.[key] = bar.[key]

)

|||

Thanks for your example! I'll give it a try.

|||

hey
Can u guide me if possible..
I'm able to create Full text indexing catalogs, populate them etc.. when i login directly from the server using Sql Server Enterprise manager but when I try to use the same login (db owner) remotely from some other machine using SQL Server Enterprise Manager, I see disabled Full-text Service and all full-text features disabled. So how can i populate or create catalogs remotely using sql server enterprise manager.
Thanks

|||Sattva,
See my reply in the http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=816452&SiteID=1&mode=1 thread..

Thanks,
John
SQL Full Text Search Blog
http://jtkane.spaces.live.com/

没有评论:

发表评论