LinqToSql and full-text search - can this be done?

Has anyone come up with a good way to do full-text search ( FREETEXT() CONTAINS()) for any number of arbitrary keywords using the standard LinqToSql query syntax?

I would obviously not have to use Stored Proc or create Dynamic SQL calls.

Obviously, I could just inflate the search string in the SPROC parameter, which uses FREETEXT () or CONTAINS (), but I was hoping to be more creative with the search and create queries such as:

pepperoni pizza and a hamburger, not an apple pie.

Crazy, I know - but wouldn't it be appropriate to do it right from LinqToSql? Any advice on how to achieve this would be greatly appreciated.

Update: I think I can be on something here ...

Also: I canceled the change made to my question because it actually changed the meaning of what I requested. I know that full-text search is not supported in LinqToSql - I would ask this question if I wanted to know. Instead, I updated my headline to soothe the masses made with edit-happy launch.

+5
source share
2 answers

Unfortunately, LINQ to SQL does not support full-text search.

, , , : Lucene.NET, NHibernate Search . LINQ NHibernate NHibernate Search, , , - -.

+4

, , , LINQ, :

string q = query.Query;
IQueryable<Story> stories = ActiveStories
                        .Join(tvf_SearchStories(q), o => o.StoryId, i => i.StoryId, (o,i) => o)
                        .Where (s => (query.CategoryIds.Contains(s.CategoryId)) &&
                                    /* time frame filter */
                                (s.PostedOn >= (query.Start ?? SqlDateTime.MinValue.Value)) &&
                                (s.PostedOn <= (query.End ?? SqlDateTime.MaxValue.Value)));

tvf_SearchStories '- ,

+5

All Articles