Remove all posting entries for an internal doc ID.
(&mut self, internal_id: u32)
| 98 | |
| 99 | /// Remove all posting entries for an internal doc ID. |
| 100 | fn remove_internal(&mut self, internal_id: u32) { |
| 101 | if let Some(dims) = self.doc_dims.remove(&internal_id) { |
| 102 | for dim in dims { |
| 103 | if let Some(list) = self.postings.get_mut(&dim) { |
| 104 | list.retain(|&(id, _)| id != internal_id); |
| 105 | if list.is_empty() { |
| 106 | self.postings.remove(&dim); |
| 107 | } |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | /// Get the posting list for a dimension. |
| 114 | pub fn get_postings(&self, dim: u32) -> Option<&[(u32, f32)]> { |