mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-23 05:14:27 +01:00
Replace an if let some by a match
This commit is contained in:
parent
28197b2435
commit
aeaac743ff
@ -174,40 +174,41 @@ impl<'a> FacetDistribution<'a> {
|
|||||||
fn facet_values(&self, field_id: FieldId) -> heed::Result<BTreeMap<String, u64>> {
|
fn facet_values(&self, field_id: FieldId) -> heed::Result<BTreeMap<String, u64>> {
|
||||||
use FacetType::{Number, String};
|
use FacetType::{Number, String};
|
||||||
|
|
||||||
if let Some(candidates) = self.candidates.as_ref() {
|
match self.candidates {
|
||||||
// Classic search, candidates were specified, we must return facet values only related
|
Some(ref candidates) => {
|
||||||
// to those candidates. We also enter here for facet strings for performance reasons.
|
// Classic search, candidates were specified, we must return facet values only related
|
||||||
let mut distribution = BTreeMap::new();
|
// to those candidates. We also enter here for facet strings for performance reasons.
|
||||||
if candidates.len() <= CANDIDATES_THRESHOLD {
|
let mut distribution = BTreeMap::new();
|
||||||
self.facet_distribution_from_documents(
|
if candidates.len() <= CANDIDATES_THRESHOLD {
|
||||||
field_id,
|
self.facet_distribution_from_documents(
|
||||||
Number,
|
field_id,
|
||||||
candidates,
|
Number,
|
||||||
&mut distribution,
|
candidates,
|
||||||
)?;
|
&mut distribution,
|
||||||
self.facet_distribution_from_documents(
|
)?;
|
||||||
field_id,
|
self.facet_distribution_from_documents(
|
||||||
String,
|
field_id,
|
||||||
candidates,
|
String,
|
||||||
&mut distribution,
|
candidates,
|
||||||
)?;
|
&mut distribution,
|
||||||
} else {
|
)?;
|
||||||
self.facet_numbers_distribution_from_facet_levels(
|
} else {
|
||||||
field_id,
|
self.facet_numbers_distribution_from_facet_levels(
|
||||||
candidates,
|
field_id,
|
||||||
&mut distribution,
|
candidates,
|
||||||
)?;
|
&mut distribution,
|
||||||
self.facet_distribution_from_documents(
|
)?;
|
||||||
field_id,
|
self.facet_distribution_from_documents(
|
||||||
String,
|
field_id,
|
||||||
candidates,
|
String,
|
||||||
&mut distribution,
|
candidates,
|
||||||
)?;
|
&mut distribution,
|
||||||
}
|
)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(distribution)
|
Ok(distribution)
|
||||||
} else {
|
}
|
||||||
self.facet_values_from_raw_facet_database(field_id)
|
None => self.facet_values_from_raw_facet_database(field_id),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user