MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / remove_document

Method remove_document

nodedb-spatial/src/geohash_index.rs:76–85  ·  view source on GitHub ↗

Remove a document from the geohash index.

(&mut self, doc_id: &str)

Source from the content-addressed store, hash-verified

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 ///

Callers 2

index_documentMethod · 0.45
remove_documentFunction · 0.45

Calls 3

removeMethod · 0.45
get_mutMethod · 0.45
is_emptyMethod · 0.45

Tested by 1

remove_documentFunction · 0.36