mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2025-12-23 02:29:57 +00:00
fix debug assert
This commit is contained in:
@@ -17,9 +17,7 @@ const HORIZON: u32 = 64u32 * 64u32;
|
|||||||
//
|
//
|
||||||
// Elements are dropped and not yielded.
|
// Elements are dropped and not yielded.
|
||||||
fn unordered_drain_filter<T, P>(v: &mut Vec<T>, mut predicate: P)
|
fn unordered_drain_filter<T, P>(v: &mut Vec<T>, mut predicate: P)
|
||||||
where
|
where P: FnMut(&mut T) -> bool {
|
||||||
P: FnMut(&mut T) -> bool,
|
|
||||||
{
|
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
while i < v.len() {
|
while i < v.len() {
|
||||||
if predicate(&mut v[i]) {
|
if predicate(&mut v[i]) {
|
||||||
@@ -145,7 +143,8 @@ impl<TScorer: Scorer, TScoreCombiner: ScoreCombiner> BufferedUnionScorer<TScorer
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn is_in_horizon(&self, target: DocId) -> bool {
|
fn is_in_horizon(&self, target: DocId) -> bool {
|
||||||
let gap = target - self.window_start_doc;
|
// wrapping_sub, because target may be < window_start_doc
|
||||||
|
let gap = target.wrapping_sub(self.window_start_doc);
|
||||||
gap < HORIZON
|
gap < HORIZON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user