Remove a document from the geohash index.
(&mut self, doc_id: &str)
| 74 | |
| 75 | /// Remove a document from the geohash index. |
| 76 | pub fn remove_document(&mut self, doc_id: &str) { |
| 77 | if let Some(old_hash) = self.entries.remove(doc_id) |
| 78 | && let Some(ids) = self.prefix_index.get_mut(&old_hash) |
| 79 | { |
| 80 | ids.retain(|id| id != doc_id); |
| 81 | if ids.is_empty() { |
| 82 | self.prefix_index.remove(&old_hash); |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | /// Find all document IDs whose geohash matches the given prefix. |
| 88 | /// |