mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-12-23 13:10:06 +01:00
Refactor
This commit is contained in:
parent
aa03e02fdc
commit
d5978d11e1
@ -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)?)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -865,9 +865,12 @@ impl IndexScheduler {
|
||||
}
|
||||
|
||||
/// Create a new index without any associated task.
|
||||
pub fn create_raw_index(&self, name: &str) -> Result<Index> {
|
||||
pub fn create_raw_index(
|
||||
&self,
|
||||
name: &str,
|
||||
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||
) -> Result<Index> {
|
||||
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)
|
||||
|
@ -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()?;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user