mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Make the facet distinct work with the new split facets
This commit is contained in:
parent
bd7b285bae
commit
e62b89a2ed
@ -25,13 +25,12 @@ pub struct FacetDistinct<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> FacetDistinct<'a> {
|
impl<'a> FacetDistinct<'a> {
|
||||||
pub fn new(
|
pub fn new(distinct: FieldId, index: &'a Index, txn: &'a heed::RoTxn<'a>) -> Self {
|
||||||
distinct: FieldId,
|
Self {
|
||||||
index: &'a Index,
|
distinct,
|
||||||
txn: &'a heed::RoTxn<'a>,
|
index,
|
||||||
) -> Self
|
txn,
|
||||||
{
|
}
|
||||||
Self { distinct, index, txn }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,10 +99,9 @@ impl<'a> FacetDistinctIter<'a> {
|
|||||||
let mut candidates_iter = self.candidates.iter().skip(self.iter_offset);
|
let mut candidates_iter = self.candidates.iter().skip(self.iter_offset);
|
||||||
match candidates_iter.next() {
|
match candidates_iter.next() {
|
||||||
Some(id) => {
|
Some(id) => {
|
||||||
match self.facet_type {
|
// We distinct the document id on its facet strings and facet numbers.
|
||||||
FacetType::String => self.distinct_string(id)?,
|
self.distinct_string(id)?;
|
||||||
FacetType::Number => self.distinct_number(id)?,
|
self.distinct_number(id)?;
|
||||||
};
|
|
||||||
|
|
||||||
// The first document of each iteration is kept, since the next call to
|
// 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
|
// `difference_with` will filter out all the documents for that facet value. By
|
||||||
|
Loading…
Reference in New Issue
Block a user