diff --git a/index-scheduler/src/insta_snapshot.rs b/index-scheduler/src/insta_snapshot.rs index 6096bad38..885a66f49 100644 --- a/index-scheduler/src/insta_snapshot.rs +++ b/index-scheduler/src/insta_snapshot.rs @@ -1,7 +1,7 @@ use std::collections::BTreeSet; use std::fmt::Write; -use meilisearch_types::heed::types::{OwnedType, SerdeBincode, SerdeJson, Str}; +use meilisearch_types::heed::types::{SerdeBincode, SerdeJson, Str}; use meilisearch_types::heed::{Database, RoTxn}; use meilisearch_types::milli::{CboRoaringBitmapCodec, RoaringBitmapCodec, BEU32}; use meilisearch_types::tasks::{Details, Task}; @@ -115,7 +115,7 @@ pub fn snapshot_bitmap(r: &RoaringBitmap) -> String { snap } -pub fn snapshot_all_tasks(rtxn: &RoTxn, db: Database, SerdeJson>) -> String { +pub fn snapshot_all_tasks(rtxn: &RoTxn, db: Database>) -> String { let mut snap = String::new(); let iter = db.iter(rtxn).unwrap(); for next in iter { @@ -125,10 +125,7 @@ pub fn snapshot_all_tasks(rtxn: &RoTxn, db: Database, SerdeJson snap } -pub fn snapshot_date_db( - rtxn: &RoTxn, - db: Database, CboRoaringBitmapCodec>, -) -> String { +pub fn snapshot_date_db(rtxn: &RoTxn, db: Database) -> String { let mut snap = String::new(); let iter = db.iter(rtxn).unwrap(); for next in iter { @@ -248,10 +245,7 @@ pub fn snapshot_index_tasks(rtxn: &RoTxn, db: Database) } snap } -pub fn snapshot_canceled_by( - rtxn: &RoTxn, - db: Database, RoaringBitmapCodec>, -) -> String { +pub fn snapshot_canceled_by(rtxn: &RoTxn, db: Database) -> String { let mut snap = String::new(); let iter = db.iter(rtxn).unwrap(); for next in iter { diff --git a/index-scheduler/src/utils.rs b/index-scheduler/src/utils.rs index f4eff7ea5..59d8f8f52 100644 --- a/index-scheduler/src/utils.rs +++ b/index-scheduler/src/utils.rs @@ -337,7 +337,7 @@ impl IndexScheduler { let rtxn = self.env.read_txn().unwrap(); for task in self.all_tasks.iter(&rtxn).unwrap() { let (task_id, task) = task.unwrap(); - let task_id = task_id.get(); + let task_id = task_id; let task_index_uid = task.index_uid().map(ToOwned::to_owned); @@ -361,16 +361,13 @@ impl IndexScheduler { .unwrap() .contains(task.uid)); } - let db_enqueued_at = self - .enqueued_at - .get(&rtxn, &BEI128::new(enqueued_at.unix_timestamp_nanos())) - .unwrap() - .unwrap(); + let db_enqueued_at = + self.enqueued_at.get(&rtxn, &enqueued_at.unix_timestamp_nanos()).unwrap().unwrap(); assert!(db_enqueued_at.contains(task_id)); if let Some(started_at) = started_at { let db_started_at = self .started_at - .get(&rtxn, &BEI128::new(started_at.unix_timestamp_nanos())) + .get(&rtxn, &started_at.unix_timestamp_nanos()) .unwrap() .unwrap(); assert!(db_started_at.contains(task_id)); @@ -378,7 +375,7 @@ impl IndexScheduler { if let Some(finished_at) = finished_at { let db_finished_at = self .finished_at - .get(&rtxn, &BEI128::new(finished_at.unix_timestamp_nanos())) + .get(&rtxn, &finished_at.unix_timestamp_nanos()) .unwrap() .unwrap(); assert!(db_finished_at.contains(task_id)); diff --git a/milli/src/index.rs b/milli/src/index.rs index 0b57c42ff..13030fc20 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -1594,7 +1594,7 @@ pub(crate) mod tests { } pub fn add_documents_using_wtxn<'t, R>( &'t self, - wtxn: &mut RwTxn<'t, '_>, + wtxn: &mut RwTxn<'t>, documents: DocumentsBatchReader, ) -> Result<(), crate::error::Error> where @@ -1638,7 +1638,7 @@ pub(crate) mod tests { } pub fn update_settings_using_wtxn<'t>( &'t self, - wtxn: &mut RwTxn<'t, '_>, + wtxn: &mut RwTxn<'t>, update: impl Fn(&mut Settings), ) -> Result<(), crate::error::Error> { let mut builder = update::Settings::new(wtxn, &self.inner, &self.indexer_config); @@ -1649,7 +1649,7 @@ pub(crate) mod tests { pub fn delete_documents_using_wtxn<'t>( &'t self, - wtxn: &mut RwTxn<'t, '_>, + wtxn: &mut RwTxn<'t>, external_document_ids: Vec, ) { let builder = IndexDocuments::new( diff --git a/milli/src/update/facet/mod.rs b/milli/src/update/facet/mod.rs index 9c1d2a370..166410d0d 100644 --- a/milli/src/update/facet/mod.rs +++ b/milli/src/update/facet/mod.rs @@ -486,8 +486,8 @@ pub(crate) mod test_helpers { let iter = self .content - .as_polymorph() - .prefix_iter::<_, ByteSlice, FacetGroupValueCodec>(txn, &level_no_prefix) + .remap_types::() + .prefix_iter(txn, &level_no_prefix) .unwrap(); for el in iter { let (key, value) = el.unwrap(); @@ -501,11 +501,8 @@ pub(crate) mod test_helpers { let start_below = { let mut start_below_iter = self .content - .as_polymorph() - .prefix_iter::<_, ByteSlice, FacetGroupValueCodec>( - txn, - &prefix_start_below, - ) + .remap_types::() + .prefix_iter(txn, &prefix_start_below) .unwrap(); let (key_bytes, _) = start_below_iter.next().unwrap().unwrap(); FacetGroupKeyCodec::::bytes_decode(key_bytes).unwrap() @@ -612,7 +609,7 @@ mod comparison_bench { } let time_spent = timer.elapsed().as_millis(); println!(" add {nbr_doc} : {time_spent}ms"); - txn.abort().unwrap(); + txn.abort(); } } } diff --git a/milli/src/update/index_documents/mod.rs b/milli/src/update/index_documents/mod.rs index 82858a09d..be2fbb25e 100644 --- a/milli/src/update/index_documents/mod.rs +++ b/milli/src/update/index_documents/mod.rs @@ -701,7 +701,7 @@ mod tests { use crate::documents::documents_batch_reader_from_objects; use crate::index::tests::TempIndex; use crate::search::TermsMatchingStrategy; - use crate::{db_snap, Filter, Search, BEU16}; + use crate::{db_snap, Filter, Search}; #[test] fn simple_document_replacement() { @@ -1743,14 +1743,11 @@ mod tests { let colour_green_id = index.fields_ids_map(&rtxn).unwrap().id("colour.green").unwrap(); let bitmap_colour = - index.facet_id_exists_docids.get(&rtxn, &BEU16::new(colour_id)).unwrap().unwrap(); + index.facet_id_exists_docids.get(&rtxn, &colour_id).unwrap().unwrap(); assert_eq!(bitmap_colour.into_iter().collect::>(), vec![0, 1, 2, 3, 4, 6, 7]); - let bitmap_colour_green = index - .facet_id_exists_docids - .get(&rtxn, &BEU16::new(colour_green_id)) - .unwrap() - .unwrap(); + let bitmap_colour_green = + index.facet_id_exists_docids.get(&rtxn, &colour_green_id).unwrap().unwrap(); assert_eq!(bitmap_colour_green.into_iter().collect::>(), vec![6, 7]); }; @@ -1848,21 +1845,15 @@ mod tests { index.fields_ids_map(&rtxn).unwrap().id("colour.green.blue").unwrap(); let bitmap_null_colour = - index.facet_id_is_null_docids.get(&rtxn, &BEU16::new(colour_id)).unwrap().unwrap(); + index.facet_id_is_null_docids.get(&rtxn, &colour_id).unwrap().unwrap(); assert_eq!(bitmap_null_colour.into_iter().collect::>(), vec![0]); - let bitmap_colour_green = index - .facet_id_is_null_docids - .get(&rtxn, &BEU16::new(colour_green_id)) - .unwrap() - .unwrap(); + let bitmap_colour_green = + index.facet_id_is_null_docids.get(&rtxn, &colour_green_id).unwrap().unwrap(); assert_eq!(bitmap_colour_green.into_iter().collect::>(), vec![2]); - let bitmap_colour_blue = index - .facet_id_is_null_docids - .get(&rtxn, &BEU16::new(colour_blue_id)) - .unwrap() - .unwrap(); + let bitmap_colour_blue = + index.facet_id_is_null_docids.get(&rtxn, &colour_blue_id).unwrap().unwrap(); assert_eq!(bitmap_colour_blue.into_iter().collect::>(), vec![3]); }; @@ -1917,21 +1908,15 @@ mod tests { let tags_blue_id = index.fields_ids_map(&rtxn).unwrap().id("tags.green.blue").unwrap(); let bitmap_empty_tags = - index.facet_id_is_empty_docids.get(&rtxn, &BEU16::new(tags_id)).unwrap().unwrap(); + index.facet_id_is_empty_docids.get(&rtxn, &tags_id).unwrap().unwrap(); assert_eq!(bitmap_empty_tags.into_iter().collect::>(), vec![2, 6, 9]); - let bitmap_tags_green = index - .facet_id_is_empty_docids - .get(&rtxn, &BEU16::new(tags_green_id)) - .unwrap() - .unwrap(); + let bitmap_tags_green = + index.facet_id_is_empty_docids.get(&rtxn, &tags_green_id).unwrap().unwrap(); assert_eq!(bitmap_tags_green.into_iter().collect::>(), vec![8]); - let bitmap_tags_blue = index - .facet_id_is_empty_docids - .get(&rtxn, &BEU16::new(tags_blue_id)) - .unwrap() - .unwrap(); + let bitmap_tags_blue = + index.facet_id_is_empty_docids.get(&rtxn, &tags_blue_id).unwrap().unwrap(); assert_eq!(bitmap_tags_blue.into_iter().collect::>(), vec![12]); }; @@ -2684,7 +2669,7 @@ mod tests { } fn delete_documents<'t>( - wtxn: &mut RwTxn<'t, '_>, + wtxn: &mut RwTxn<'t>, index: &'t TempIndex, external_ids: &[&str], ) -> Vec { diff --git a/milli/src/update/settings.rs b/milli/src/update/settings.rs index 926c89cf5..e8c6e2c10 100644 --- a/milli/src/update/settings.rs +++ b/milli/src/update/settings.rs @@ -1565,7 +1565,7 @@ mod tests { }) .unwrap_err(); assert!(matches!(error, Error::UserError(UserError::PrimaryKeyCannotBeChanged(_)))); - wtxn.abort().unwrap(); + wtxn.abort(); // But if we clear the database... let mut wtxn = index.write_txn().unwrap();