From a38608fe59c1e169d698c1324fe966dc0cd069b3 Mon Sep 17 00:00:00 2001 From: ManyTheFish Date: Thu, 1 Sep 2022 12:02:10 +0200 Subject: [PATCH] Add test mixing phrased and no-phrased words --- milli/src/search/query_tree.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/milli/src/search/query_tree.rs b/milli/src/search/query_tree.rs index 51774d8b4..5fd004c99 100644 --- a/milli/src/search/query_tree.rs +++ b/milli/src/search/query_tree.rs @@ -1058,6 +1058,26 @@ mod test { "###); } + #[test] + fn phrase_2() { + // https://github.com/meilisearch/meilisearch/issues/2722 + let query = "coco \"harry\""; + let tokens = query.tokenize(); + + let (query_tree, _) = TestContext::default() + .build(TermsMatchingStrategy::default(), true, None, tokens) + .unwrap() + .unwrap(); + + insta::assert_debug_snapshot!(query_tree, @r###" + OR(WORD) + Exact { word: "harry" } + AND + Exact { word: "coco" } + Exact { word: "harry" } + "###); + } + #[test] fn phrase_with_hard_separator() { let query = "\"hey friends. wooop wooop\"";