From c18e907f965e7e4da98f4870c3b399fb2d22913f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 30 Mar 2020 20:56:26 +0200 Subject: [PATCH] Construct a Set using the from_dirty method This commit fixes #566 by ensuring that the slice of matches is ordered and deduplicated. --- meilisearch-core/src/query_tree.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meilisearch-core/src/query_tree.rs b/meilisearch-core/src/query_tree.rs index e4965a656..319b997a0 100644 --- a/meilisearch-core/src/query_tree.rs +++ b/meilisearch-core/src/query_tree.rs @@ -531,7 +531,7 @@ pub fn traverse_query_tree<'o, 'txn>( let docids = SetBuf::new(docids).unwrap(); debug!("{:2$}docids construction took {:.02?}", "", before.elapsed(), depth * 2); - let matches = Cow::Owned(SetBuf::new(matches).unwrap()); + let matches = Cow::Owned(SetBuf::from_dirty(matches)); let key = PostingsKey { query, input: vec![], distance: 0, is_exact: true }; postings.insert(key, matches);