且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何配置 Solr 使用 Levenshtein 近似字符串匹配?

更新时间:2022-11-14 08:52:58

通常这是通过 SpellCheckComponent,它在内部默认使用 Lucene SpellChecker,它实现了 Levenshtein.>

wiki 真的很好地解释了它的工作原理、如何配置它以及有哪些选项可用,这里不再重复.

或者您可以使用 Lucene 的模糊搜索运算符.

另一种选择是使用 语音过滤器 而不是 Levenshtein.

Does Apaches Solr search engine provide approximate string matches, e.g. via Levenshtein algorithm?

I'm looking for a way to find customers by last name. But I cannot guarantee the correctness of the names. How can I configure Solr so that it would find the person "Levenshtein" even if I search for "Levenstein" ?

Typically this is done with the SpellCheckComponent, which internally uses the Lucene SpellChecker by default, which implements Levenshtein.

The wiki really explains very well how it works, how to configure it and what options are available, no point repeating it here.

Or you could just use Lucene's fuzzy search operator.

Another option is using a phonetic filter instead of Levenshtein.