Fix warnings

This commit is contained in:
Louis Dureuil 2024-12-02 14:29:52 +01:00
parent 6a1d26a60c
commit 057143214d
No known key found for this signature in database

View File

@ -104,7 +104,6 @@ pub(crate) enum IndexOperation {
index_uid: String, index_uid: String,
primary_key: Option<String>, primary_key: Option<String>,
method: IndexDocumentsMethod, method: IndexDocumentsMethod,
documents_counts: Vec<u64>,
operations: Vec<DocumentOperation>, operations: Vec<DocumentOperation>,
tasks: Vec<Task>, tasks: Vec<Task>,
}, },
@ -130,19 +129,6 @@ pub(crate) enum IndexOperation {
index_uid: String, index_uid: String,
cleared_tasks: Vec<Task>, cleared_tasks: Vec<Task>,
// The boolean indicates if it's a settings deletion or creation.
settings: Vec<(bool, Settings<Unchecked>)>,
settings_tasks: Vec<Task>,
},
SettingsAndDocumentOperation {
index_uid: String,
primary_key: Option<String>,
method: IndexDocumentsMethod,
documents_counts: Vec<u64>,
operations: Vec<DocumentOperation>,
document_import_tasks: Vec<Task>,
// The boolean indicates if it's a settings deletion or creation. // The boolean indicates if it's a settings deletion or creation.
settings: Vec<(bool, Settings<Unchecked>)>, settings: Vec<(bool, Settings<Unchecked>)>,
settings_tasks: Vec<Task>, settings_tasks: Vec<Task>,
@ -174,12 +160,7 @@ impl Batch {
IndexOperation::DocumentEdition { task, .. } => { IndexOperation::DocumentEdition { task, .. } => {
RoaringBitmap::from_sorted_iter(std::iter::once(task.uid)).unwrap() RoaringBitmap::from_sorted_iter(std::iter::once(task.uid)).unwrap()
} }
IndexOperation::SettingsAndDocumentOperation { IndexOperation::DocumentClearAndSetting {
document_import_tasks: tasks,
settings_tasks: other,
..
}
| IndexOperation::DocumentClearAndSetting {
cleared_tasks: tasks, cleared_tasks: tasks,
settings_tasks: other, settings_tasks: other,
.. ..
@ -239,8 +220,7 @@ impl IndexOperation {
| IndexOperation::DocumentDeletion { index_uid, .. } | IndexOperation::DocumentDeletion { index_uid, .. }
| IndexOperation::DocumentClear { index_uid, .. } | IndexOperation::DocumentClear { index_uid, .. }
| IndexOperation::Settings { index_uid, .. } | IndexOperation::Settings { index_uid, .. }
| IndexOperation::DocumentClearAndSetting { index_uid, .. } | IndexOperation::DocumentClearAndSetting { index_uid, .. } => index_uid,
| IndexOperation::SettingsAndDocumentOperation { index_uid, .. } => index_uid,
} }
} }
} }
@ -262,9 +242,6 @@ impl fmt::Display for IndexOperation {
IndexOperation::DocumentClearAndSetting { .. } => { IndexOperation::DocumentClearAndSetting { .. } => {
f.write_str("IndexOperation::DocumentClearAndSetting") f.write_str("IndexOperation::DocumentClearAndSetting")
} }
IndexOperation::SettingsAndDocumentOperation { .. } => {
f.write_str("IndexOperation::SettingsAndDocumentOperation")
}
} }
} }
} }
@ -330,21 +307,14 @@ impl IndexScheduler {
}) })
.flatten(); .flatten();
let mut documents_counts = Vec::new();
let mut operations = Vec::new(); let mut operations = Vec::new();
for task in tasks.iter() { for task in tasks.iter() {
match task.kind { match task.kind {
KindWithContent::DocumentAdditionOrUpdate { KindWithContent::DocumentAdditionOrUpdate { content_file, .. } => {
content_file,
documents_count,
..
} => {
documents_counts.push(documents_count);
operations.push(DocumentOperation::Add(content_file)); operations.push(DocumentOperation::Add(content_file));
} }
KindWithContent::DocumentDeletion { ref documents_ids, .. } => { KindWithContent::DocumentDeletion { ref documents_ids, .. } => {
documents_counts.push(documents_ids.len() as u64);
operations.push(DocumentOperation::Delete(documents_ids.clone())); operations.push(DocumentOperation::Delete(documents_ids.clone()));
} }
_ => unreachable!(), _ => unreachable!(),
@ -356,7 +326,6 @@ impl IndexScheduler {
index_uid, index_uid,
primary_key, primary_key,
method, method,
documents_counts,
operations, operations,
tasks, tasks,
}, },
@ -1243,7 +1212,6 @@ impl IndexScheduler {
index_uid: _, index_uid: _,
primary_key, primary_key,
method, method,
documents_counts: _,
operations, operations,
mut tasks, mut tasks,
} => { } => {
@ -1633,43 +1601,6 @@ impl IndexScheduler {
Ok(tasks) Ok(tasks)
} }
IndexOperation::SettingsAndDocumentOperation {
index_uid,
primary_key,
method,
documents_counts,
operations,
document_import_tasks,
settings,
settings_tasks,
} => {
let settings_tasks = self.apply_index_operation(
index_wtxn,
index,
IndexOperation::Settings {
index_uid: index_uid.clone(),
settings,
tasks: settings_tasks,
},
)?;
let mut import_tasks = self.apply_index_operation(
index_wtxn,
index,
IndexOperation::DocumentOperation {
index_uid,
primary_key,
method,
documents_counts,
operations,
tasks: document_import_tasks,
},
)?;
let mut tasks = settings_tasks;
tasks.append(&mut import_tasks);
Ok(tasks)
}
IndexOperation::DocumentClearAndSetting { IndexOperation::DocumentClearAndSetting {
index_uid, index_uid,
cleared_tasks, cleared_tasks,