diff --git a/dump/src/lib.rs b/dump/src/lib.rs index b9e44b5c3..b428001cc 100644 --- a/dump/src/lib.rs +++ b/dump/src/lib.rs @@ -117,7 +117,10 @@ pub(crate) mod test { uid: 0, index_uid: Some(S("doggos")), status: Status::Succeeded, - kind: Kind::DocumentAddition, + kind: Kind::DocumentImport { + method: index::milli::update::IndexDocumentsMethod::UpdateDocuments, + allow_index_creation: true, + }, details: Some(Details::DocumentAddition { received_documents: 10_000, indexed_documents: 3, @@ -135,7 +138,10 @@ pub(crate) mod test { uid: 1, index_uid: Some(S("doggos")), status: Status::Enqueued, - kind: Kind::DocumentAddition, + kind: Kind::DocumentImport { + method: index::milli::update::IndexDocumentsMethod::UpdateDocuments, + allow_index_creation: true, + }, details: None, error: None, duration: Some(Duration::DAY), diff --git a/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-3.snap b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-3.snap index 95310da23..90e7d583c 100644 --- a/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-3.snap +++ b/dump/src/reader/compat/snapshots/dump__reader__compat__v5_to_v6__test__compat_v5_v6-3.snap @@ -18,7 +18,12 @@ expression: tasks "uid": 20, "indexUid": "movies_2", "status": "enqueued", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 200, "indexedDocuments": 0 @@ -29,7 +34,12 @@ expression: tasks "uid": 19, "indexUid": "movies", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 100, "indexedDocuments": 100 @@ -43,7 +53,12 @@ expression: tasks "uid": 18, "indexUid": "dnd_spells", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -57,7 +72,12 @@ expression: tasks "uid": 17, "indexUid": "dnd_spells", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -71,7 +91,12 @@ expression: tasks "uid": 16, "indexUid": "products", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -85,7 +110,12 @@ expression: tasks "uid": 15, "indexUid": "products", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -99,7 +129,11 @@ expression: tasks "uid": 14, "indexUid": "products", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "synonyms": { "android": [ @@ -126,7 +160,11 @@ expression: tasks "uid": 13, "indexUid": "movies", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "rankingRules": [ "words", @@ -147,7 +185,11 @@ expression: tasks "uid": 12, "indexUid": "movies", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "filterableAttributes": [ "genres", @@ -166,7 +208,12 @@ expression: tasks "uid": 11, "indexUid": "movies", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -180,7 +227,12 @@ expression: tasks "uid": 10, "indexUid": "movies", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 100, "indexedDocuments": 100 @@ -194,7 +246,12 @@ expression: tasks "uid": 9, "indexUid": "movies", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 90, "indexedDocuments": 90 @@ -221,7 +278,12 @@ expression: tasks "uid": 7, "indexUid": "dnd_spells", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -235,7 +297,12 @@ expression: tasks "uid": 6, "indexUid": "dnd_spells", "status": "failed", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 0 @@ -255,7 +322,12 @@ expression: tasks "uid": 5, "indexUid": "products", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 @@ -269,7 +341,12 @@ expression: tasks "uid": 4, "indexUid": "products", "status": "failed", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 0 @@ -289,7 +366,11 @@ expression: tasks "uid": 3, "indexUid": "products", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "synonyms": { "android": [ @@ -316,7 +397,11 @@ expression: tasks "uid": 2, "indexUid": "movies", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "rankingRules": [ "words", @@ -337,7 +422,11 @@ expression: tasks "uid": 1, "indexUid": "movies", "status": "succeeded", - "type": "settings", + "type": { + "settings": { + "allow_index_creation": true + } + }, "details": { "filterableAttributes": [ "genres", @@ -356,7 +445,12 @@ expression: tasks "uid": 0, "indexUid": "movies", "status": "succeeded", - "type": "documentAddition", + "type": { + "documentImport": { + "method": "ReplaceDocuments", + "allow_index_creation": true + } + }, "details": { "receivedDocuments": 10, "indexedDocuments": 10 diff --git a/dump/src/reader/compat/v3_to_v4.rs b/dump/src/reader/compat/v3_to_v4.rs index bf7a384bf..4b20b34c1 100644 --- a/dump/src/reader/compat/v3_to_v4.rs +++ b/dump/src/reader/compat/v3_to_v4.rs @@ -1,6 +1,6 @@ -use std::fs::File; -use uuid::Uuid; + + use crate::reader::{v3, v4, DumpReader, IndexReader}; use crate::Result; @@ -327,7 +327,7 @@ pub(crate) mod test { let mut products = indexes.pop().unwrap(); let mut movies2 = indexes.pop().unwrap(); - let mut movies = indexes.pop().unwrap(); + let movies = indexes.pop().unwrap(); let mut spells = indexes.pop().unwrap(); assert!(indexes.is_empty()); diff --git a/dump/src/reader/compat/v4_to_v5.rs b/dump/src/reader/compat/v4_to_v5.rs index 3ada6e6c5..96131e88c 100644 --- a/dump/src/reader/compat/v4_to_v5.rs +++ b/dump/src/reader/compat/v4_to_v5.rs @@ -1,4 +1,4 @@ -use std::fs::File; + use crate::reader::{v4, v5, DumpReader, IndexReader}; use crate::Result; diff --git a/dump/src/reader/mod.rs b/dump/src/reader/mod.rs index d10fc3b7b..a01f422de 100644 --- a/dump/src/reader/mod.rs +++ b/dump/src/reader/mod.rs @@ -2,8 +2,8 @@ use std::io::Read; use std::{fs::File, io::BufReader}; use flate2::bufread::GzDecoder; -use index_scheduler::TaskView; -use meilisearch_auth::Key; + + use serde::Deserialize; use tempfile::TempDir; diff --git a/dump/src/reader/v3/mod.rs b/dump/src/reader/v3/mod.rs index 93942f427..aa682b205 100644 --- a/dump/src/reader/v3/mod.rs +++ b/dump/src/reader/v3/mod.rs @@ -31,7 +31,7 @@ use std::{ use serde::{Deserialize, Serialize}; use tempfile::TempDir; use time::OffsetDateTime; -use uuid::Uuid; + pub mod errors; pub mod meta; diff --git a/dump/src/reader/v6.rs b/dump/src/reader/v6.rs index ddb42996f..8535047bb 100644 --- a/dump/src/reader/v6.rs +++ b/dump/src/reader/v6.rs @@ -178,7 +178,7 @@ pub struct V6IndexReader { } impl V6IndexReader { - pub fn new(name: String, path: &Path) -> Result { + pub fn new(_name: String, path: &Path) -> Result { let metadata = File::open(path.join("metadata.json"))?; let ret = V6IndexReader {