views:

33

answers:

2

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.

+1  A: 

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%'
Joe Stefanelli
Thanks; my problem is that as the source text is in a word or pdf document stored in the database I am not able to query the contents of it through TSQL.
u07ch
Ahh...missed that bit of the question. Sorry.
Joe Stefanelli
+1  A: 

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.

u07ch