I'm trying to perform an specific term full-text search in SQL Server. It looks like the way to do it is by wrapping the keywords in double quotes, which I'm doing in my app:
Query = "\"" + model.SearchString + "\""
However, when I perform the query against the database with a term such as "foo bar", it returns every occurrence of "foo" and "bar" inside the database. The expected result is that the database should return only the records that have "foo bar" specifically. This is the query:
SELECT o.OpinionDocumentId
FROM CONTAINSTABLE(OpinionDocuments, Html, '"foo bar"') AS KEY_TBL
LEFT JOIN dbo.OpinionDocuments AS o ON o.OpinionDocumentId = KEY_TBL.[KEY]
WHERE o.Date BETWEEN @from AND @to
What could be the reason why this query is not returning the results from an specific set of keywords?
Thanks