From df7a32e3d0589b72c82a323968a5e72edf34f912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 21 Apr 2021 11:48:23 +0200 Subject: [PATCH] Move the creation date initialization into a function --- milli/src/index.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/milli/src/index.rs b/milli/src/index.rs index f222069f6..07af6286b 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -81,16 +81,7 @@ impl Index { let field_id_docid_facet_values = env.create_database(Some("field-id-docid-facet-values"))?; let documents = env.create_database(Some("documents"))?; - { - let mut txn = env.write_txn()?; - // The db was just created, we update its metadata with the relevant information. - if main.get::<_, Str, SerdeJson>>(&txn, CREATED_AT_KEY)?.is_none() { - let now = Utc::now(); - main.put::<_, Str, SerdeJson>>(&mut txn, UPDATED_AT_KEY, &now)?; - main.put::<_, Str, SerdeJson>>(&mut txn, CREATED_AT_KEY, &now)?; - txn.commit()?; - } - } + Index::initialize_creation_dates(&env, main)?; Ok(Index { env,