Add explanatory comment

This commit is contained in:
Louis Dureuil 2023-10-19 15:58:25 +02:00 committed by GitHub
parent aa2cd52797
commit 18bbadf645
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,9 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
let mut all_candidates = universe - excluded; let mut all_candidates = universe - excluded;
all_candidates.extend(results.iter().copied()); all_candidates.extend(results.iter().copied());
// drain the results of the skipped elements
// this **must** be done **after** writing the entire results in `all_candidates` to ensure
// e.g. estimatedTotalHits is correct.
if results.len() >= from { if results.len() >= from {
results.drain(..from); results.drain(..from);
} else { } else {