Hamed Khatami
Hamed Khatami

Reputation: 545

FullText Search priory

i want to use full text search for create simple search engin.

for example when user search "Hamed Khatami",search engine fetch rows that have both word then

fetch rows that have one of them.

i created bottom query

select * from dbo.DownloadCenterFileLanguage

where CONTAINS(*,N' "*PC*" and "*Game*" ')

UNION

select * row from dbo.DownloadCenterFileLanguage

where CONTAINS(*,N' "*PC*" or "*Game*" ')

but it has a problem , it order result base on P.K.

Appreciate to help me.

Regards

Upvotes: 1

Views: 30

Answers (1)

Hamed Khatami
Hamed Khatami

Reputation: 545

after a day , i understand that my approach is wrong.

look at these codes

select * from dbo.DownloadCenterFileLanguage
inner join
CONTAINSTABLE (dbo.DownloadCenterFileLanguage,
   *, 'ISABOUT ( "hamed" , "khatami" ,"*hamed*", "*khatami*"')') AS KEY_TBL
ON DownloadCenterFileLanguage.Id = KEY_TBL.[KEY]

with this approach everything work correctly

Best Regards

Upvotes: 2

Related Questions