FREETEXT 搜索 - 根据匹配程度对结果进行排序

发布于 2024-11-23 16:54:51 字数 121 浏览 7 评论 0原文

我正在尝试实现全文搜索。我正在使用 FREETEXT 并且得到了正确的结果。问题在于结果的排序。如果尝试搜索“停车场”,则匹配这两个词的结果应该位于开头,然后是仅匹配其中一个词的结果。我怎样才能做到这一点?

感谢

I'm trying to implement a Full Text Search. I'm using FREETEXT and I get the correct results. The problem is the ordering of results. If try to search for "car park" the results that match both those words should be at the beginning and then those matching only one of them. How can I accomplish this?

Thank

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

躲猫猫 2024-11-30 16:54:51

使用 FREETEXTTABLE 而不是 FREETEXT。

FREETEXTTABLE 将返回包含排名信息的键表。您可以对此排名信息进行排序,以查找最接近匹配的项目。

Microsoft FREETEXTTABLE 文档

以下示例显示了其工作原理:

SELECT
    t.TableID
    , t.TextData
    , ft.Rank
FROM
    Table t
    INNER JOIN FREETEXTTABLE ( Table , * , 'car park' ) ft ON ( t.TableID = ft.[Key] )
ORDER BY
    ft.Rank DESC

Use FREETEXTTABLE instead of FREETEXT.

FREETEXTTABLE will return a table of keys with Rank information. You can sort on this Rank information to find the items that are the closest matches.

Microsoft FREETEXTTABLE documentation

The following example shows how this works:

SELECT
    t.TableID
    , t.TextData
    , ft.Rank
FROM
    Table t
    INNER JOIN FREETEXTTABLE ( Table , * , 'car park' ) ft ON ( t.TableID = ft.[Key] )
ORDER BY
    ft.Rank DESC
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文