coder
coder

Reputation: 2000

Implement full text search for searching multiple Keywords

I have implemented full-Text search in my application for searching a keyword from a table in my database.Now i want to extend the search for multiple words.I googled for it but didnt get the answer i wanted.Can anyone tell how to extend the search for multiple keywords.

Query:

select ProductCode,CategorySequenceNumber from tblProductMaster where Contains(*,@stringToSearch)

Any suggessions will be appriciated..

Upvotes: 0

Views: 1465

Answers (3)

jaczjill
jaczjill

Reputation: 334

Use FREETEXT function intead of CONTAINS. seperate your keywords with spaces.

Upvotes: 0

Luke Marlin
Luke Marlin

Reputation: 1398

Pass in your keywords separated by "AND" or "OR" depending on the behavior you want :

SET @stringtosearch = '"this" AND "word" OR "test"'

Upvotes: 2

jalgames
jalgames

Reputation: 789

You can split the search text at spaces to a string array and then search for each of the elements.

Upvotes: 0

Related Questions