“听起来像”、“你是这个意思吗” SQL Server 2005 中使用全文搜索的功能
我已经使用 CONTAINSTABLE 关键字在 SQL Server 2005 数据库上实现了全文搜索。 我想知道如果原始查询没有产生任何结果,是否有办法添加“听起来像”或谷歌的“你的意思是那个”功能。
I have implemented full text search over SQL Server 2005 database using CONTAINSTABLE keyword.
I was wondering is there a way to add a "sounds like" or google's "did you mean THAT" functionality if the original query yields no results.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您希望能够做到这一点,您需要规范原始文本和查询。 简单的示例,如果您希望能够搜索 SOUNDEX 类型的值,则需要对查询字符串和您正在查询的原始数据进行 SOUNDEX 处理。 您无法即时有效地处理查询空间,因此您可以在创建索引期间对其进行规范化。
从技术上讲,您只需要规范化实际索引,而不是数据,但由于您的数据可能是您的索引,因此需要对其进行规范化。
这与单词的“词干提取”、删除复数等过程相同。
If you want to be able to do this you need to normalize the raw text and the queries. Simple example, if you want to be able to search on a SOUNDEX type of value, you'll need to SOUNDEX both the query string and the original raw data that you're querying. You can't efficiently process the query space on the fly, so instead you normalize it during the creation of the index.
Technically, you need only normalize the actual index, not the data, but since your data likely IS you index, then it will need to be normalized.
This is the same process as "stemming" of words, removing plurals, etc.
SQL Server 的 soundex 非常有限且令人沮丧,我真的建议您看看 Lucene.net http://incubator.apache.org/lucene.net/。 Lucene是一个高性能、全功能的文本搜索引擎库,它在.NET项目中也非常易于使用。 如果您的应用程序需要一个严肃的搜索引擎,请选择 Lucene。
从 http://lucene.apache.org/java/docs/features 检索的一些功能。 html:
The soundex for SQL Server is very limited and frustrating, I really recomend you to take a look at Lucene.net http://incubator.apache.org/lucene.net/. Lucene is a high-performance, full-featured text search engine library, it is also very easy to use in .NET projects. If you need a serious search engine for you app go with Lucene.
Some features retrieved from http://lucene.apache.org/java/docs/features.html:
SQL Server 具有函数 SOUNDEX 和 差异
这个相关的答案可能有用:如何使 sql 搜索查询更强大?
SQL Server has the functions SOUNDEX and DIFFERENCE
This related SO answer might be useful: How to make a sql search query more powerful?