question

Michael Wanke avatar image
Michael Wanke asked

Return the tokens matched in addition to the rows with a Full Text Search Query

I am working on a SQL Server 2008R2 query that leverages full text searching to find the appropriate rows with the data. However, I also have the requirement of providing which words matched when the terms were evaluated using OR inside CONTAINS() or CONTAINSTABLE(). I cannot seem to find or come up with a way to produce the results that doesn't require each term being re-evaluated for the presence of the term. ---------- Query to find associated records: SELECT documentId, content FROM dbo.tbl_Documents d INNER JOIN CONTAINSTABLE(tbl_Documents, contents, '"*West*" OR "*Consent*" OR "*Test*"') AS filter ON d.documentId = filter.[Key] ---------- This returns: documentId content 7 West of the Mississippi 10 West today, I consent. 13 West yesterday, east today, let us test. ---------- However, I need something like this: documentId content matchSet 7 West of the Mississippi west 10 West today, I consent. west, consent 13 West yesterday, east today, let us test. west, test

Any ideas or suggestions on where to start? I decided to post this question to the forums [here...][1] [1]: http://www.sqlservercentral.com/Forums/Topic1124709-392-1.aspx?Update=1
sql-server-2008-r2full-text
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.