From 62930ecc4e3747f3e13e649598f8b5d5ceb958ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 17 Jun 2019 10:44:16 +0200 Subject: [PATCH] feat: Deduplicate automatons when synonyms produce duplicated ones --- meilidb-core/src/query_builder.rs | 35 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/meilidb-core/src/query_builder.rs b/meilidb-core/src/query_builder.rs index e11ec4535..4158bd1ba 100644 --- a/meilidb-core/src/query_builder.rs +++ b/meilidb-core/src/query_builder.rs @@ -25,30 +25,35 @@ fn generate_automatons(query: &str, store: &S) -> Result { let mut iter = matches.into_iter(); assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 0, .. })); // new - assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 0, .. })); // new - assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 1, .. })); // york assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 1, .. })); // york assert_matches!(iter.next(), Some(Match { query_index: 1, word_index: 2, .. })); // subway assert_matches!(iter.next(), None); @@ -679,8 +682,6 @@ mod tests { assert_matches!(iter.next(), Some(Document { id: DocumentId(0), matches }) => { let mut iter = matches.into_iter(); assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 0, .. })); // new - assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 0, .. })); // new - assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 1, .. })); // york assert_matches!(iter.next(), Some(Match { query_index: 0, word_index: 1, .. })); // york assert_matches!(iter.next(), Some(Match { query_index: 1, word_index: 2, .. })); // subway assert_matches!(iter.next(), None);