diff --git a/index-scheduler/src/index_mapper.rs b/index-scheduler/src/index_mapper.rs index cad74a4b6..de9e47df3 100644 --- a/index-scheduler/src/index_mapper.rs +++ b/index-scheduler/src/index_mapper.rs @@ -75,11 +75,10 @@ impl IndexMapper { options.map_size(clamp_to_page_size(self.index_size)); options.max_readers(1024); - if date == None { - Ok(Index::new(options, path)?) - } else { - let (created, updated) = date.unwrap(); + if let Some((created, updated)) = date { Ok(Index::new_with_creation_dates(options, path, created, updated)?) + } else { + Ok(Index::new(options, path)?) } } diff --git a/index-scheduler/src/lib.rs b/index-scheduler/src/lib.rs index a9068adb4..111f2960c 100644 --- a/index-scheduler/src/lib.rs +++ b/index-scheduler/src/lib.rs @@ -865,9 +865,12 @@ impl IndexScheduler { } /// Create a new index without any associated task. - pub fn create_raw_index(&self, name: &str) -> Result { + pub fn create_raw_index( + &self, + name: &str, + date: Option<(time::OffsetDateTime, time::OffsetDateTime)>, + ) -> Result { let wtxn = self.env.write_txn()?; - let date = Some((time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc())); let index = self.index_mapper.create_index(wtxn, name, date)?; Ok(index) diff --git a/meilisearch/src/lib.rs b/meilisearch/src/lib.rs index b11f063d2..6d966aab1 100644 --- a/meilisearch/src/lib.rs +++ b/meilisearch/src/lib.rs @@ -277,7 +277,9 @@ fn import_dump( let mut index_reader = index_reader?; let metadata = index_reader.metadata(); log::info!("Importing index `{}`.", metadata.uid); - let index = index_scheduler.create_raw_index(&metadata.uid)?; + //let date = Some((time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc())); + let date = dump_reader.date(); + let index = index_scheduler.create_raw_index(&metadata.uid, date)?; let mut wtxn = index.write_txn()?;