我的 Sql Server 存储过程中的搜索查询出现问题
我有以下存储过程:-
SELECT Id, Name
FROM FooBars
WHERE CONTAINS(Name, 'FORMSOF(Tesaurus, @query)')
当查询中有一个单词时工作正常:例如。 富* 但当我想要寻找多个单词时,它就会失败。 例如。 foo* bar* (这意味着任何包含以 foo 开头和以 bar 开头的单词的行)。
我的 @query 参数需要采用什么格式才能启用同义词库的全文搜索的多个单词?
I have the following stored proc :-
SELECT Id, Name
FROM FooBars
WHERE CONTAINS(Name, 'FORMSOF(Tesaurus, @query)')
Works fine when there is one word i the query: eg. foo*
But it fails when I want to have more than one word which i'm trying to look for.
eg. foo* bar* (this means any rows that have words that start with foo and start with bar).
What format does my @query argument need to look like, to enable multiple words for a Full Text Search with a Thesaurus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我所知,如果您想搜索两个或多个表达式,则需要将它们与 AND、OR 或 NEAR 连接起来,如下所示(直接来自在线图书):
If and how that will work with your FORMSOF (...) 我不清楚表达方式 - 但我相信你可以很快尝试一下,不是吗?
还要确保在 FORMSOF () 表达式中正确拼写“thesaurus”! :-)
马克
As far as I know, if you want to search for two or more expressions, you need to concatenate those with either AND, OR or NEAR, something like this (straight from Books Online):
If and how that would work together with your FORMSOF(...) expression is unclear to me - but I'm sure you could quickly try that, no?
Also make sure to spell "thesaurus" correctly in your FORMSOF () expression! :-)
Marc