From aa414565bb184e626dfb5ae64d00d1f2371ef91d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Lecrenier?= Date: Sun, 5 Mar 2023 19:49:39 +0100 Subject: [PATCH] Fix proximity graph edge builder to include all proximities --- milli/src/search/new/ranking_rule_graph/proximity/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/milli/src/search/new/ranking_rule_graph/proximity/build.rs b/milli/src/search/new/ranking_rule_graph/proximity/build.rs index 9b4fa8edf..0d7e68272 100644 --- a/milli/src/search/new/ranking_rule_graph/proximity/build.rs +++ b/milli/src/search/new/ranking_rule_graph/proximity/build.rs @@ -108,7 +108,7 @@ pub fn visit_to_node<'transaction, 'from_data>( if updb2 { for word1 in derivations1.clone() { - for proximity in 0..(7 - ngram_len2) { + for proximity in 1..=(8 - ngram_len2) { let cost = (proximity + ngram_len2 - 1) as u8; if db_cache .get_word_prefix_pair_proximity_docids( @@ -139,7 +139,7 @@ pub fn visit_to_node<'transaction, 'from_data>( let product_derivations = derivations1.cartesian_product(derivations2); for (word1, word2) in product_derivations { - for proximity in 0..(7 - ngram_len2) { + for proximity in 1..=(8 - ngram_len2) { let cost = (proximity + ngram_len2 - 1) as u8; // TODO: do the opposite way with a proximity penalty as well! // search for (word2, word1, proximity-1), I guess?