【发布时间】:2011-11-01 04:39:04
【问题描述】:
我在我的项目中使用模糊匹配主要是为了查找拼写错误和同名的不同拼写。我需要准确理解弹性搜索的模糊匹配是如何工作的,以及它是如何使用标题中提到的两个参数的。
据我了解,min_similarity 是查询字符串与数据库中的字符串匹配的百分比。我找不到有关如何计算此值的确切说明。
据我了解,max_expansions 是应该执行搜索的 Levenshtein 距离。如果这实际上是 Levenshtein 距离,那对我来说将是理想的解决方案。无论如何,它不起作用 例如我有“Samvel”这个词
queryStr max_expansions matches?
samvel 0 Should not be 0. error (but levenshtein distance can be 0!)
samvel 1 Yes
samvvel 1 Yes
samvvell 1 Yes (but it shouldn't have)
samvelll 1 Yes (but it shouldn't have)
saamvelll 1 No (but for some weird reason it matches with Samvelian)
saamvelll anything bigger than 1 No
文档中说了一些我实际上不明白的内容:
Add max_expansions to the fuzzy query allowing to control the maximum number
of terms to match. Default to unbounded (or bounded by the max clause count in
boolean query).
那么请任何人向我解释一下这些参数究竟是如何影响搜索结果的。
【问题讨论】:
标签: elasticsearch fuzzy-search fuzzy-logic fuzzy-comparison