gpt4 book ai didi

Mysql全文索引对完全匹配和部分匹配给出相同的分数,为什么?

转载 作者:行者123 更新时间:2023-11-29 06:38:35 30 4
gpt4 key购买 nike

我在带有全文索引的 mysql 5.6 中有这种奇怪的行为

我正在尝试搜索患者数据库并首先获得完全匹配,然后使用最低分数按分数进行部分匹配,因此我不会返回 100000 多个结果,只是一些防止重复进入 EHR 类型应用程序的建议

问题是完全匹配和部分匹配的分数相同...

这是预期的行为吗?我有什么选择?

enter image description here

最佳答案

您声明完全匹配和部分匹配的分数相同,但您的示例中没有任何完全匹配。 (“路易斯测试”!=“路易斯文本”)。它只是有各种部分匹配。

这是预期的行为,因为使用自然语言模式的 MATCH 仅面向单词。它不会对部分单词匹配进行评分——即,相似的单词不计入相关值。由于每条记录中匹配的词数相同,且每条记录的总词数相同,因此它们各自获得相同的相关值(分数)。

"Relevance is computed based on the number of words in the row, the number of unique words in that row, the total number of words in the collection, and the number of documents (rows) that contain a particular word." -- http://dev.mysql.com/doc/refman/5.6/en/fulltext-natural-language.html

如果你想对单词进行模糊匹配,你应该看看这个 SO 问题,寻找可能的替代匹配方案: How do I do a fuzzy match of company names in MYSQL with PHP for auto-complete?

关于Mysql全文索引对完全匹配和部分匹配给出相同的分数,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22942659/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com