mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-27 04:25:06 +08:00
Improve the estimatedNbHits when distinct is enabled
This commit is contained in:
parent
4f547eff02
commit
d2f84a9d9e
@ -223,7 +223,6 @@ impl<'a> Search<'a> {
|
|||||||
debug!("Number of candidates found {}", candidates.len());
|
debug!("Number of candidates found {}", candidates.len());
|
||||||
|
|
||||||
let excluded = take(&mut excluded_candidates);
|
let excluded = take(&mut excluded_candidates);
|
||||||
|
|
||||||
let mut candidates = distinct.distinct(candidates, excluded);
|
let mut candidates = distinct.distinct(candidates, excluded);
|
||||||
|
|
||||||
initial_candidates |= bucket_candidates;
|
initial_candidates |= bucket_candidates;
|
||||||
@ -236,10 +235,12 @@ impl<'a> Search<'a> {
|
|||||||
for candidate in candidates.by_ref().take(self.limit - documents_ids.len()) {
|
for candidate in candidates.by_ref().take(self.limit - documents_ids.len()) {
|
||||||
documents_ids.push(candidate?);
|
documents_ids.push(candidate?);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
excluded_candidates |= candidates.into_excluded();
|
||||||
|
|
||||||
if documents_ids.len() == self.limit {
|
if documents_ids.len() == self.limit {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
excluded_candidates = candidates.into_excluded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(SearchResult {
|
Ok(SearchResult {
|
||||||
|
Loading…
Reference in New Issue
Block a user