I have a Thesaurus table in my database, I want to collect data using FREETEXT. However the string I'm searching for contains spaces.
For example, I want to search for the code "AB 001"
select *
from TheThesaurus
where freetext(TheDefinition, 'AB 001')
This code will search for both "AB" and "001", which will give me a lot more junk results. I tried putting the string in double quotes, but it's not working either.
select *
from TheThesaurus
where freetext(TheDefinition, '"AB 001"')
How can I do so I can search for the full "AB 001" string??
I used LIKE and it's giving me the desired result, but I want to try full-text search since it is much faster and will give more accurate result in my case.
select *
from TheThesaurus
where TheDefinition LIKE '%AB 001%'
Thanks!
EDIT
I tried using CONTAINS
, but it was giving me extra results that I could not understand why they are being returned. The CONTAINS
function doesn't work for me either :/
select *
from TheThesaurus
where Contains(TheDefinition, 'AB%001')