mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-22 18:17:39 +08:00
wip
This commit is contained in:
parent
e547552702
commit
edd8344dc9
@ -1,12 +1,12 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
autobatcher::BatchKind,
|
autobatcher::BatchKind,
|
||||||
task::{Kind, KindWithContent, Status, Task},
|
task::{Details, Kind, KindWithContent, Status, Task},
|
||||||
Error, IndexScheduler, Result, TaskId,
|
Error, IndexScheduler, Result, TaskId,
|
||||||
};
|
};
|
||||||
use index::{Settings, Unchecked};
|
use index::{Settings, Unchecked};
|
||||||
use milli::{
|
use milli::{
|
||||||
heed::{RoTxn, RwTxn},
|
heed::{RoTxn, RwTxn},
|
||||||
update::IndexDocumentsMethod,
|
update::{DocumentAdditionResult, IndexDocumentsMethod},
|
||||||
DocumentId,
|
DocumentId,
|
||||||
};
|
};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
@ -434,11 +434,39 @@ impl IndexScheduler {
|
|||||||
Batch::Dump(_) => todo!(),
|
Batch::Dump(_) => todo!(),
|
||||||
Batch::DocumentClear { tasks, .. } => todo!(),
|
Batch::DocumentClear { tasks, .. } => todo!(),
|
||||||
Batch::DocumentAddition {
|
Batch::DocumentAddition {
|
||||||
index_uid: _,
|
index_uid,
|
||||||
primary_key: _,
|
primary_key,
|
||||||
content_files: _,
|
content_files,
|
||||||
tasks: _,
|
mut tasks,
|
||||||
} => todo!(),
|
} => {
|
||||||
|
let index = self.index_mapper.create_index(wtxn, &index_uid)?;
|
||||||
|
let ret = index.update_documents(
|
||||||
|
IndexDocumentsMethod::ReplaceDocuments,
|
||||||
|
primary_key,
|
||||||
|
self.file_store.clone(),
|
||||||
|
content_files,
|
||||||
|
)?;
|
||||||
|
|
||||||
|
for (task, ret) in tasks.iter_mut().zip(ret) {
|
||||||
|
match ret {
|
||||||
|
Ok(DocumentAdditionResult {
|
||||||
|
indexed_documents,
|
||||||
|
number_of_documents,
|
||||||
|
}) => {
|
||||||
|
task.details = Some(Details::DocumentAddition {
|
||||||
|
received_documents: number_of_documents,
|
||||||
|
indexed_documents,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
// TODO: TAMO: find a way to convert all errors to the `Task::Error` type
|
||||||
|
// task.error = Some(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
Batch::SettingsAndDocumentAddition {
|
Batch::SettingsAndDocumentAddition {
|
||||||
index_uid,
|
index_uid,
|
||||||
primary_key,
|
primary_key,
|
||||||
|
@ -276,8 +276,8 @@ pub enum Kind {
|
|||||||
pub enum Details {
|
pub enum Details {
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
DocumentAddition {
|
DocumentAddition {
|
||||||
received_documents: usize,
|
received_documents: u64,
|
||||||
indexed_documents: Option<u64>,
|
indexed_documents: u64,
|
||||||
},
|
},
|
||||||
#[serde(rename_all = "camelCase")]
|
#[serde(rename_all = "camelCase")]
|
||||||
Settings {
|
Settings {
|
||||||
|
Loading…
Reference in New Issue
Block a user