Jerry
Jerry

Reputation: 6577

Linq query to perform a full text search

How can the following be done with a linq statement?

SELECT Description 
FROM Production.ProductDescription 
WHERE FREETEXT(Description, 'Some Keywords')

Upvotes: 2

Views: 811

Answers (2)

AD.Net
AD.Net

Reputation: 13409

I am not sure, but you might have to search each column/property of the table against your keyword to mimick freetext. ex:

    context.Production.ProductDescription
.Where(pd=>pd.Property1.Contains("Keyword") || pd.Property2.Contains("Keyword");

Upvotes: 2

Brandon Moretz
Brandon Moretz

Reputation: 7641

No, the full text search function FREETEXT in TSQL is not directly accessible with Linq to SQL.

You would have to execute that query directly in a database function, then you can pull your result set back with Linq to SQL.

Upvotes: 6

Related Questions