From 526202ec8b79efe4659fd17413af3bb4742b29e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Thu, 17 Oct 2019 18:03:11 +0200 Subject: [PATCH] Make the levenshtein algorithm consider transpositions to cost 1 --- meilidb-core/src/automaton/dfa.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meilidb-core/src/automaton/dfa.rs b/meilidb-core/src/automaton/dfa.rs index 015fdd877..eb9ff0714 100644 --- a/meilidb-core/src/automaton/dfa.rs +++ b/meilidb-core/src/automaton/dfa.rs @@ -19,21 +19,21 @@ fn build_dfa_with_setting(query: &str, setting: PrefixSetting) -> DFA { match query.len() { 0 ..= 4 => { - let builder = LEVDIST0.get_or_init(|| LevBuilder::new(0, false)); + let builder = LEVDIST0.get_or_init(|| LevBuilder::new(0, true)); match setting { Prefix => builder.build_prefix_dfa(query), NoPrefix => builder.build_dfa(query), } }, 5 ..= 8 => { - let builder = LEVDIST1.get_or_init(|| LevBuilder::new(1, false)); + let builder = LEVDIST1.get_or_init(|| LevBuilder::new(1, true)); match setting { Prefix => builder.build_prefix_dfa(query), NoPrefix => builder.build_dfa(query), } }, _ => { - let builder = LEVDIST2.get_or_init(|| LevBuilder::new(2, false)); + let builder = LEVDIST2.get_or_init(|| LevBuilder::new(2, true)); match setting { Prefix => builder.build_prefix_dfa(query), NoPrefix => builder.build_dfa(query),