mirror of
https://github.com/meilisearch/MeiliSearch
synced 2024-11-26 06:44:27 +01:00
Get date from IndexMetaData
This commit is contained in:
parent
df176aaf01
commit
9a39c4e40d
@ -9,6 +9,7 @@ use meilisearch_types::heed::types::Str;
|
||||
use meilisearch_types::heed::{Database, Env, EnvOpenOptions, RoTxn, RwTxn};
|
||||
use meilisearch_types::milli::update::IndexerConfig;
|
||||
use meilisearch_types::milli::Index;
|
||||
use time::OffsetDateTime;
|
||||
use uuid::Uuid;
|
||||
|
||||
use self::IndexStatus::{Available, BeingDeleted};
|
||||
@ -69,7 +70,7 @@ impl IndexMapper {
|
||||
fn create_or_open_index(
|
||||
&self,
|
||||
path: &Path,
|
||||
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
) -> Result<Index> {
|
||||
let mut options = EnvOpenOptions::new();
|
||||
options.map_size(clamp_to_page_size(self.index_size));
|
||||
@ -87,7 +88,7 @@ impl IndexMapper {
|
||||
&self,
|
||||
mut wtxn: RwTxn,
|
||||
name: &str,
|
||||
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
) -> Result<Index> {
|
||||
match self.index(&wtxn, name) {
|
||||
Ok(index) => {
|
||||
|
@ -693,7 +693,7 @@ impl IndexScheduler {
|
||||
|
||||
let mut task = Task {
|
||||
uid: self.next_task_id(&wtxn)?,
|
||||
enqueued_at: time::OffsetDateTime::now_utc(),
|
||||
enqueued_at: OffsetDateTime::now_utc(),
|
||||
started_at: None,
|
||||
finished_at: None,
|
||||
error: None,
|
||||
@ -868,11 +868,10 @@ impl IndexScheduler {
|
||||
pub fn create_raw_index(
|
||||
&self,
|
||||
name: &str,
|
||||
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||
date: Option<(OffsetDateTime, OffsetDateTime)>,
|
||||
) -> Result<Index> {
|
||||
let wtxn = self.env.write_txn()?;
|
||||
let index = self.index_mapper.create_index(wtxn, name, date)?;
|
||||
|
||||
Ok(index)
|
||||
}
|
||||
|
||||
|
@ -289,13 +289,8 @@ fn import_dump(
|
||||
let mut index_reader = index_reader?;
|
||||
let metadata = index_reader.metadata();
|
||||
log::info!("Importing index `{}`.", metadata.uid);
|
||||
let date;
|
||||
if let Some(dump_reader_date) = dump_reader.date() {
|
||||
date = Some((dump_reader_date, dump_reader_date));
|
||||
} else {
|
||||
date = Some((time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc()));
|
||||
}
|
||||
|
||||
let date = Some((metadata.created_at, metadata.updated_at));
|
||||
let index = index_scheduler.create_raw_index(&metadata.uid, date)?;
|
||||
|
||||
let mut wtxn = index.write_txn()?;
|
||||
|
Loading…
Reference in New Issue
Block a user