mirror of
https://github.com/meilisearch/meilisearch.git
synced 2025-09-06 04:36:32 +00:00
Take the minimum between max_total_hits and local universe len when processing an hybrid search
This commit is contained in:
@ -41,7 +41,8 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
|
|||||||
|
|
||||||
let distinct_fid = distinct_fid(distinct, ctx.index, ctx.txn)?;
|
let distinct_fid = distinct_fid(distinct, ctx.index, ctx.txn)?;
|
||||||
|
|
||||||
if universe.len() < from as u64 {
|
let universe_len = universe.len() as usize;
|
||||||
|
if universe_len < from {
|
||||||
return Ok(BucketSortOutput {
|
return Ok(BucketSortOutput {
|
||||||
docids: vec![],
|
docids: vec![],
|
||||||
scores: vec![],
|
scores: vec![],
|
||||||
@ -167,6 +168,9 @@ pub fn bucket_sort<'ctx, Q: RankingRuleQueryTrait>(
|
|||||||
_ => length,
|
_ => length,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// if the universe is smaller than the max length to evaluate, we can stop early
|
||||||
|
let max_len_to_evaluate = std::cmp::min(universe_len, max_len_to_evaluate);
|
||||||
|
|
||||||
while valid_docids.len() < max_len_to_evaluate {
|
while valid_docids.len() < max_len_to_evaluate {
|
||||||
if time_budget.exceeded() {
|
if time_budget.exceeded() {
|
||||||
loop {
|
loop {
|
||||||
|
Reference in New Issue
Block a user