mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
fix: Clamp the document range requested
This commit is contained in:
parent
37c709c9a9
commit
af91bfa11f
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::ops::Range;
|
use std::ops::Range;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::{mem, vec};
|
use std::{mem, vec, cmp};
|
||||||
|
|
||||||
use fnv::FnvHashMap;
|
use fnv::FnvHashMap;
|
||||||
use fst::Streamer;
|
use fst::Streamer;
|
||||||
@ -92,6 +92,10 @@ where C: Criterion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let range = Range {
|
||||||
|
start: cmp::min(range.start, documents.len()),
|
||||||
|
end: cmp::min(range.end, documents.len()),
|
||||||
|
};
|
||||||
documents[range].to_vec()
|
documents[range].to_vec()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user