From d344489c124287a0fb8a601f5983afe0e350cc67 Mon Sep 17 00:00:00 2001 From: Irevoire Date: Wed, 25 Aug 2021 14:58:36 +0200 Subject: [PATCH] implement the deletion of geo points --- milli/src/update/delete_documents.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/milli/src/update/delete_documents.rs b/milli/src/update/delete_documents.rs index 874eed6ee..0c29b744d 100644 --- a/milli/src/update/delete_documents.rs +++ b/milli/src/update/delete_documents.rs @@ -380,6 +380,19 @@ impl<'t, 'u, 'i> DeleteDocuments<'t, 'u, 'i> { drop(iter); + if let Some(mut rtree) = self.index.geo_rtree(self.wtxn)? { + let points_to_remove: Vec<_> = rtree + .iter() + .filter(|&point| self.documents_ids.contains(point.data)) + .cloned() + .collect(); + points_to_remove.iter().for_each(|point| { + rtree.remove(&point); + }); + + self.index.put_geo_rtree(self.wtxn, &rtree)?; + } + // We delete the documents ids that are under the facet field id values. remove_docids_from_facet_field_id_number_docids( self.wtxn,