From 8f2a551ccadfaec0ef0579c36acd22d4f6cb7f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Tue, 18 Jun 2019 15:47:47 +0200 Subject: [PATCH] feat: Trigger synonym replacement only when the last word is tipped --- meilidb-core/src/query_builder.rs | 40 ++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/meilidb-core/src/query_builder.rs b/meilidb-core/src/query_builder.rs index 5325e6eb7..ce427698a 100644 --- a/meilidb-core/src/query_builder.rs +++ b/meilidb-core/src/query_builder.rs @@ -31,18 +31,25 @@ fn generate_automatons(query: &str, store: &S) -> Result(query: &str, store: &S) -> Result { + assert_eq!(matches.len(), 1); + let match_ = matches[0]; + assert_eq!(match_.query_index, 0); + assert_eq!(match_.word_index, 0); + }); assert_matches!(iter.next(), None); let builder = QueryBuilder::new(&store); let results = builder.query("bonj blabla", 0..20).unwrap(); let mut iter = results.into_iter(); + assert_matches!(iter.next(), Some(Document { id: DocumentId(0), matches }) => { + assert_eq!(matches.len(), 1); + let match_ = matches[0]; + assert_eq!(match_.query_index, 0); + assert_eq!(match_.word_index, 0); + }); assert_matches!(iter.next(), None); }