From 733c02dd7c7b34265f07b4106b53d1a5eb873da2 Mon Sep 17 00:00:00 2001 From: mpostma Date: Tue, 1 Sep 2020 10:12:00 +0200 Subject: [PATCH] fix facet count bug --- meilisearch-core/src/bucket_sort.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/meilisearch-core/src/bucket_sort.rs b/meilisearch-core/src/bucket_sort.rs index f0fc71bd0..6c9b87301 100644 --- a/meilisearch-core/src/bucket_sort.rs +++ b/meilisearch-core/src/bucket_sort.rs @@ -100,6 +100,12 @@ where debug!("found {} documents", docids.len()); debug!("number of postings {:?}", queries.len()); + if let Some(f) = facet_count_docids { + // hardcoded value, until approximation optimization + result.exhaustive_facets_count = Some(true); + result.facets = Some(facet_count(f, &docids)); + } + if let Some(facets_docids) = facets_docids { let intersection = sdset::duo::OpBuilder::new(docids.as_ref(), facets_docids.as_set()) .intersection() @@ -107,12 +113,6 @@ where docids = Cow::Owned(intersection); } - if let Some(f) = facet_count_docids { - // hardcoded value, until approximation optimization - result.exhaustive_facets_count = Some(true); - result.facets = Some(facet_count(f, &docids)); - } - let before = Instant::now(); mk_arena!(arena); let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries); @@ -243,6 +243,12 @@ where debug!("found {} documents", docids.len()); debug!("number of postings {:?}", queries.len()); + if let Some(f) = facet_count_docids { + // hardcoded value, until approximation optimization + result.exhaustive_facets_count = Some(true); + result.facets = Some(facet_count(f, &docids)); + } + if let Some(facets_docids) = facets_docids { let intersection = OpBuilder::new(docids.as_ref(), facets_docids.as_set()) .intersection() @@ -250,12 +256,6 @@ where docids = Cow::Owned(intersection); } - if let Some(f) = facet_count_docids { - // hardcoded value, until approximation optimization - result.exhaustive_facets_count = Some(true); - result.facets = Some(facet_count(f, &docids)); - } - let before = Instant::now(); mk_arena!(arena); let mut bare_matches = cleanup_bare_matches(&mut arena, &docids, queries);