From e62b89a2edaf252fb7713074b171b82fe851258f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 3 May 2021 10:05:36 +0200 Subject: [PATCH] Make the facet distinct work with the new split facets --- milli/src/search/distinct/facet_distinct.rs | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/milli/src/search/distinct/facet_distinct.rs b/milli/src/search/distinct/facet_distinct.rs index 44dd6bc66..7411e4af9 100644 --- a/milli/src/search/distinct/facet_distinct.rs +++ b/milli/src/search/distinct/facet_distinct.rs @@ -25,13 +25,12 @@ pub struct FacetDistinct<'a> { } impl<'a> FacetDistinct<'a> { - pub fn new( - distinct: FieldId, - index: &'a Index, - txn: &'a heed::RoTxn<'a>, - ) -> Self - { - Self { distinct, index, txn } + pub fn new(distinct: FieldId, index: &'a Index, txn: &'a heed::RoTxn<'a>) -> Self { + Self { + distinct, + index, + txn, + } } } @@ -100,10 +99,9 @@ impl<'a> FacetDistinctIter<'a> { let mut candidates_iter = self.candidates.iter().skip(self.iter_offset); match candidates_iter.next() { Some(id) => { - match self.facet_type { - FacetType::String => self.distinct_string(id)?, - FacetType::Number => self.distinct_number(id)?, - }; + // We distinct the document id on its facet strings and facet numbers. + self.distinct_string(id)?; + self.distinct_number(id)?; // The first document of each iteration is kept, since the next call to // `difference_with` will filter out all the documents for that facet value. By