How do you use Linq to ADO.NET entity framework to do full text search (FTS)?

c# entity-framework full-text-search linq-to-entities sql-server-2008

Question

Now that full text search is a built-in feature of SQL Server 2008 It will serve as the search engine for my website. For my ORM, I'm also considering utilizing ADO.NET entity framework, however I was curious how full text search (FTS) works with Linq to ADO.NET entity framework.

Does the ADO.NET entity framework provide any support, or must I continue to use the a process for developing a function that makes advantage of full-text search predicates?

1
11
2/11/2009 12:14:32 AM

Accepted Answer

Only a small portion of the available SQL capability is supported by Entity Framework (partly to remain compatible over a range of providers). However, full-text is not supported by even LINQ-to-SQL (which supports a lot more SQL-Server specific features, such UDFs).

I think a stored procedure or udf is required. The UDF technique is favored since the database server can compile it and the metadata layer is much stronger than it is with other approaches; unfortunately, Entity Framework doesn't like UDFs (or didn't, last time I looked) ;-p Thus, using a saved process could be necessary.

12
2/11/2009 5:03:10 AM

Popular Answer

I've seen EF4 code that looks like this:

var query = context.ExecuteStoreQuery<Person>(
        "SELECT * FROM People WHERE FREETEXT(*,{0})", 
        searchText
    ).AsQueryable();

In certain instances, this could be more straightforward than writing a stored procedure or UDP.



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow