diff --git a/src/store/mod.rs b/src/store/mod.rs index 860407bcf..00e0c4b13 100644 --- a/src/store/mod.rs +++ b/src/store/mod.rs @@ -133,12 +133,22 @@ pub mod tests { format!("Doc {}", i) ); } + for (_, doc) in store.iter(Some(&delete_bitset)).enumerate() { let doc = doc?; let title_content = doc.get_first(field_title).unwrap().text().unwrap(); if !title_content.starts_with("Doc ") { panic!("unexpected title_content {}", title_content); } + + let id = title_content + .strip_prefix("Doc ") + .unwrap() + .parse::() + .unwrap(); + if delete_bitset.is_deleted(id) { + panic!("unexpected deleted document {}", id); + } } Ok(()) diff --git a/src/store/reader.rs b/src/store/reader.rs index 28a6d0683..3166986c0 100644 --- a/src/store/reader.rs +++ b/src/store/reader.rs @@ -171,11 +171,6 @@ impl StoreReader { .filter_map(move |doc_id| { // filter_map is only used to resolve lifetime issues between the two closures on // the outer variables - let alive = delete_bitset.map_or(true, |bitset| bitset.is_alive(doc_id)); - if !alive { - // we keep the number of skipped documents to move forward in the map block - num_skipped += 1; - } // check move to next checkpoint if doc_id >= curr_checkpoint.as_ref().unwrap().doc_range.end { @@ -187,6 +182,7 @@ impl StoreReader { num_skipped = 0; } + let alive = delete_bitset.map_or(true, |bitset| bitset.is_alive(doc_id)); if alive { let ret = Some((curr_block.clone(), num_skipped, reset_block_pos)); // the map block will move over the num_skipped, so we reset to 0 @@ -194,6 +190,8 @@ impl StoreReader { reset_block_pos = false; ret } else { + // we keep the number of skipped documents to move forward in the map block + num_skipped += 1; None } })