Skip to content

Commit

Permalink
Respect removed documents in count_documents().
Browse files Browse the repository at this point in the history
  • Loading branch information
tmpfs committed Aug 20, 2022
1 parent 2e35ea6 commit 326c5bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,13 @@ impl<T: Eq + Hash + Copy + Debug> Index<T> {
let mut pointer_option = node.first_doc;
let mut document_frequency = 0;
while let Some(pointer) = pointer_option {
document_frequency += 1;
let is_removed = match &self.removed {
Some(set) => set.contains(&self.arena_doc.get(pointer).unwrap().details_key),
None => false,
};
if !is_removed {
document_frequency += 1;
}
pointer_option = self.arena_doc.get(pointer).unwrap().next;
}
document_frequency
Expand Down

0 comments on commit 326c5bf

Please sign in to comment.