From 49240c367af8750151dc73d1675ab7e99bedac3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Sun, 19 Mar 2023 14:28:15 +0100 Subject: [PATCH] Fix bug in cost of typo conditions --- milli/src/search/new/ranking_rule_graph/typo/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/search/new/ranking_rule_graph/typo/mod.rs b/milli/src/search/new/ranking_rule_graph/typo/mod.rs index d6553a49d..e1e01d6b1 100644 --- a/milli/src/search/new/ranking_rule_graph/typo/mod.rs +++ b/milli/src/search/new/ranking_rule_graph/typo/mod.rs @@ -1,6 +1,6 @@ use roaring::RoaringBitmap; -use super::{RankingRuleGraph, RankingRuleGraphTrait, DeadEndsCache}; +use super::{DeadEndsCache, RankingRuleGraph, RankingRuleGraphTrait}; use crate::search::new::interner::{DedupInterner, Interned, MappedInterner}; use crate::search::new::logger::SearchLogger; use crate::search::new::query_graph::QueryNodeData; @@ -64,7 +64,7 @@ impl RankingRuleGraphTrait for TypoGraph { // Ngrams have a base typo cost // 2-gram -> equivalent to 1 typo // 3-gram -> equivalent to 2 typos - let base_cost = positions.len().max(2) as u8; + let base_cost = positions.len().min(2) as u8; for nbr_typos in 0..=2 { let term = term_interner.get(*value).clone();