如何制作跨多个多列和多个术语的 FREETEXTTABLE 并进行排名?
我有一个像这样的客户表:
ID*, 标题, 名, 中间名, 姓, CompanyName
所有字符串字段均可为空。
我需要能够为用户提供模糊搜索。因此,例如,他们可以输入以下搜索,它将返回排名结果:
“BOB” “鲍勃·琼斯” “鲍勃·乔恩*” “琼斯先生” “鲍勃·戴夫·琼斯” 《BD 琼斯》 “鲍勃·琼斯 ACME 公司” “ACME公司” “ACME鲍勃” 我的问题
是似乎没有办法进行通配符/LIKE% 匹配。因此,如果存在姓氏“JONESY”,则搜索“JONES”不会匹配该姓氏。
在理想的情况下,我想将所有字符串列连接到一个列中,然后对其进行模糊搜索,因为排名会更好。
谁能告诉我如何进行通配符搜索或在连接字段上搜索?
谢谢,
西蒙。
I've got a customer table like this:
ID*,
Title,
FirstName,
MiddleNames,
LastName,
CompanyName
All string fields are nullable.
I need to be able to offer the user a fuzzy search. So, for example, they could enter the following searches and it would bring back ranked results:
"BOB"
"BOB JONES"
"BOB JON*"
"MR JONES"
"BOB DAVE JONES"
"B D JONES"
"BOB JONES ACME CORP"
"ACME CORP"
"ACME BOB"
etc.
My problem is that there doesn't seem to be a way to do wildcard/LIKE% matches. So if there is a surname "JONESY", searching "JONES" doesn't match it.
In an ideal world, I'd like to CONCATENATE all the string columns in to a single column and then do my fuzzy search on that, because the ranking would be better.
Can anybody tell me how to either do wildcard searches OR search on CONCATENATED fields?
Thanks,
Simon.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在表中的多个列上定义 SQL Server 全文索引。
像这样针对表的全文查询可以指定要查询的列,也可以一次查询所有列。
全文搜索不支持真正的通配符匹配,但支持前缀匹配。这意味着您可以搜索“JONES*”,它将匹配“JONESON”或“JONESY”。
使用 FREETEXTTABLE 将为您的结果提供排名。
“JONES”的前缀匹配如下所示:
You can define a SQL Server full-text index on multiple columns in a table.
Full-Text queries against a table like this can either specify the column for querying or query against all columns at once.
Full-Text search does not support true wildcard matching but it does support prefix matching. This means that you can search for "JONES*" and it will match "JONESON" or "JONESY".
Using FREETEXTTABLE will provide Rank for your results.
A prefix match for "JONES" would look like this:
我也在做这样的搜索。这是帮助我的链接
http://www.codeproject.com/KB/database/ SQLServer2K8FullTextSearchh.aspx
i was also doing that kind of search. here is the link which helped me
http://www.codeproject.com/KB/database/SQLServer2K8FullTextSearh.aspx