LinqToSql和全文搜索 - 可以完成吗? [英] LinqToSql and full text search - can it be done?
问题描述
是否有人想出了使用标准LinqToSql查询语法为任意数量的任意关键字执行全文搜索( FREETEXT()CONTAINS()
)的好方法?
我显然希望避免使用Stored Proc或必须生成动态SQL调用。
显然,我可以将参数中的搜索字符串抽到使用FREETEXT()或CONTAINS()的SPROC中,但我希望能够更加富有创造性地进行搜索并构建查询,如:
意大利辣香肠比萨饼和汉堡,而不是苹果派。
疯狂的我知道 - 但它不会很整洁直接从LinqToSql做到这一点?任何提示如何实现这一点,将不胜感激。
更新:我想我可能会对这里 ...
另外:我回滚了对我的更改问题的标题,因为它实际上改变了我所问的意义。我知道LinqToSql不支持全文搜索 - 如果我想知道,我会问这个问题。相反,我已经更新了我的标题以安抚edit-happy-trigger-fingers群众。
解析方案 支持全文搜索。
我认为可能有一系列产品:Lucene.NET,NHibernate Search。将NHibernate的NHibernate与NHibernate Search结合起来可能会提供这样的功能,但两者在测试中都还很深入。
Has anyone come up with a good way of performing full text searches (FREETEXT() CONTAINS()
) for any number of arbitrary keywords using standard LinqToSql query syntax?
I'd obviously like to avoid having to use a Stored Proc or have to generate a Dynamic SQL calls.
Obviously I could just pump the search string in on a parameter to a SPROC that uses FREETEXT() or CONTAINS(), but I was hoping to be more creative with the search and build up queries like:
"pepperoni pizza" and burger, not "apple pie".
Crazy I know - but wouldn't it be neat to be able to do this directly from LinqToSql? Any tips on how to achieve this would be much appreciated.
Update: I think I may be on to something here...
Also: I rolled back the change made to my question title because it actually changed the meaning of what I was asking. I know that full text search is not supported in LinqToSql - I would have asked that question if I wanted to know that. Instead - I have updated my title to appease the edit-happy-trigger-fingered masses.
Unfortunately LINQ to SQL does not support Full Text Search.
There are a bunch of products out there that I think could: Lucene.NET, NHibernate Search comes to mind. LINQ for NHibernate combined with NHibernate Search would probably give that functionality, but both are still way deep in beta.
这篇关于LinqToSql和全文搜索 - 可以完成吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!