mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 13:10:06 +01:00
Limit the number of elements after reversing it
This commit is contained in:
parent
9d966a28d3
commit
0e5609d40e
@ -177,8 +177,12 @@ impl<'a> Search<'a> {
|
||||
}
|
||||
}
|
||||
docids_values.sort_unstable_by_key(|(_, value)| *value);
|
||||
let iter = docids_values.into_iter().map(|(id, _)| id).take(limit);
|
||||
if ascending { Ok(iter.collect()) } else { Ok(iter.rev().collect()) }
|
||||
let iter = docids_values.into_iter().map(|(id, _)| id);
|
||||
if ascending {
|
||||
Ok(iter.take(limit).collect())
|
||||
} else {
|
||||
Ok(iter.rev().take(limit).collect())
|
||||
}
|
||||
} else {
|
||||
let facet_fn = if ascending {
|
||||
FacetIter::<f64, FacetLevelValueF64Codec>::new
|
||||
@ -208,8 +212,12 @@ impl<'a> Search<'a> {
|
||||
}
|
||||
}
|
||||
docids_values.sort_unstable_by_key(|(_, value)| *value);
|
||||
let iter = docids_values.into_iter().map(|(id, _)| id).take(limit);
|
||||
if ascending { Ok(iter.collect()) } else { Ok(iter.rev().collect()) }
|
||||
let iter = docids_values.into_iter().map(|(id, _)| id);
|
||||
if ascending {
|
||||
Ok(iter.take(limit).collect())
|
||||
} else {
|
||||
Ok(iter.rev().take(limit).collect())
|
||||
}
|
||||
} else {
|
||||
let facet_fn = if ascending {
|
||||
FacetIter::<i64, FacetLevelValueI64Codec>::new
|
||||
|
Loading…
x
Reference in New Issue
Block a user