u07ch
u07ch

Reputation: 13702

Full Text Search Exact Match - in binaries

I have a query that is running something like this in SQL Server 2008

Select [key], Rank
From ContainsTable(tblDocuments, '"Exact Match"')

At the time we decided to use SQL FTS Exact Matching wasn't a requirement; sadly requirements move on and now we are interested in the possibility of getting exact matches too - i am not in a place where I can easily drop in Lucene or DTSearch. This doesn't appear to be so easy As I am searching stored documents I don't have the option of falling back on standard sql to get my exact match.

Upvotes: 2

Views: 1347

Answers (2)

u07ch
u07ch

Reputation: 13702

OK after a quick email back and forth with Michael Cole (of Pro Full Text Search in SQL 2008 Book fame0 it turns out this is a bug in SQL 2008 Full text search. There is a bug report on connect which covers the FTS not working on phrase based searching.

Upvotes: 2

Joe Stefanelli
Joe Stefanelli

Reputation: 135808

It's not pretty, but your best bet may be to go with something like:

Select [key], Rank
From ContainsTable(tblDocuments, '"Exact Match"')
union all
Select d.YourPrimaryKey as [Key], null as [Rank]
From tblDocuments d
Where d.YourColumn like '%Exact Match%'

Upvotes: 1

Related Questions