Separate side effect and debug asserts

This commit is contained in:
Louis Dureuil 2024-11-20 16:24:31 +01:00
parent a38344acb3
commit e0864f1b21
No known key found for this signature in database
2 changed files with 6 additions and 19 deletions

View File

@ -300,7 +300,6 @@ where
let span = tracing::trace_span!(target: "indexing::documents::extract", "geo"); let span = tracing::trace_span!(target: "indexing::documents::extract", "geo");
let _entered = span.enter(); let _entered = span.enter();
// let geo_sender = extractor_sender.geo_points();
let Some(extractor) = GeoExtractor::new(&rtxn, index, grenad_parameters)? else { let Some(extractor) = GeoExtractor::new(&rtxn, index, grenad_parameters)? else {
break 'geo; break 'geo;
}; };
@ -323,21 +322,6 @@ where
)?; )?;
} }
// TODO THIS IS TOO MUCH
// - [ ] Extract fieldid docid facet number
// - [ ] Extract fieldid docid facet string
// - [ ] Extract facetid string fst
// - [ ] Extract facetid normalized string strings
// TODO Inverted Indexes again
// - [x] Extract fieldid facet isempty docids
// - [x] Extract fieldid facet isnull docids
// - [x] Extract fieldid facet exists docids
// TODO This is the normal system
// - [x] Extract fieldid facet number docids
// - [x] Extract fieldid facet string docids
{ {
let span = tracing::trace_span!(target: "indexing::documents::extract", "FINISH"); let span = tracing::trace_span!(target: "indexing::documents::extract", "FINISH");
let _entered = span.enter(); let _entered = span.enter();

View File

@ -36,14 +36,17 @@ where
let mut frozen = data.into_inner().freeze()?; let mut frozen = data.into_inner().freeze()?;
for result in frozen.iter_and_clear_removed() { for result in frozen.iter_and_clear_removed() {
let extracted_geo_point = result?; let extracted_geo_point = result?;
debug_assert!(rtree.remove(&GeoPoint::from(extracted_geo_point)).is_some()); let removed = rtree.remove(&GeoPoint::from(extracted_geo_point));
debug_assert!(faceted.remove(extracted_geo_point.docid)); debug_assert!(removed.is_some());
let removed = faceted.remove(extracted_geo_point.docid);
debug_assert!(removed);
} }
for result in frozen.iter_and_clear_inserted() { for result in frozen.iter_and_clear_inserted() {
let extracted_geo_point = result?; let extracted_geo_point = result?;
rtree.insert(GeoPoint::from(extracted_geo_point)); rtree.insert(GeoPoint::from(extracted_geo_point));
debug_assert!(faceted.insert(extracted_geo_point.docid)); let inserted = faceted.insert(extracted_geo_point.docid);
debug_assert!(inserted);
} }
} }