mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-29 16:45:30 +08:00
fix all compilation errors
This commit is contained in:
parent
8d51c1f389
commit
19154e48fe
@ -42,13 +42,15 @@ impl ErrorCode for Error {
|
|||||||
Error::IndexNotFound(_) => Code::IndexNotFound,
|
Error::IndexNotFound(_) => Code::IndexNotFound,
|
||||||
Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists,
|
Error::IndexAlreadyExists(_) => Code::IndexAlreadyExists,
|
||||||
Error::TaskNotFound(_) => Code::TaskNotFound,
|
Error::TaskNotFound(_) => Code::TaskNotFound,
|
||||||
Error::InvalidStatus(_) => todo!(),
|
Error::InvalidStatus(_) => Code::BadRequest,
|
||||||
Error::InvalidKind(_) => todo!(),
|
Error::InvalidKind(_) => Code::BadRequest,
|
||||||
Error::Heed(_) => todo!(),
|
|
||||||
Error::Milli(_) => todo!(),
|
// TODO: TAMO: are all these errors really internal?
|
||||||
Error::IndexError(_) => todo!(),
|
Error::Heed(_) => Code::Internal,
|
||||||
Error::FileStore(_) => todo!(),
|
Error::Milli(_) => Code::Internal,
|
||||||
Error::IoError(_) => todo!(),
|
Error::IndexError(_) => Code::Internal,
|
||||||
|
Error::FileStore(_) => Code::Internal,
|
||||||
|
Error::IoError(_) => Code::Internal,
|
||||||
Error::Anyhow(_) => Code::Internal,
|
Error::Anyhow(_) => Code::Internal,
|
||||||
Error::CorruptedTaskQueue => Code::Internal,
|
Error::CorruptedTaskQueue => Code::Internal,
|
||||||
}
|
}
|
||||||
|
@ -260,19 +260,31 @@ async fn document_addition(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (file, uuid) = meilisearch.create_update_file()?;
|
// TODO: TAMO: do something with the update file
|
||||||
|
// Box::new(payload_to_stream(body))
|
||||||
|
let (uuid, file) = meilisearch.create_update_file()?;
|
||||||
|
|
||||||
let update = KindWithContent::DocumentAddition {
|
let task = match method {
|
||||||
content_file: Box::new(payload_to_stream(body)),
|
IndexDocumentsMethod::ReplaceDocuments => KindWithContent::DocumentAddition {
|
||||||
documents_count: 0, // TODO: TAMO: get the document count
|
content_file: uuid,
|
||||||
primary_key,
|
documents_count: 0, // TODO: TAMO: get the document count
|
||||||
method,
|
primary_key,
|
||||||
format,
|
allow_index_creation,
|
||||||
allow_index_creation,
|
index_uid,
|
||||||
index_uid,
|
},
|
||||||
|
|
||||||
|
IndexDocumentsMethod::UpdateDocuments => KindWithContent::DocumentUpdate {
|
||||||
|
content_file: uuid,
|
||||||
|
documents_count: 0, // TODO: TAMO: get the document count
|
||||||
|
primary_key,
|
||||||
|
allow_index_creation,
|
||||||
|
index_uid,
|
||||||
|
},
|
||||||
|
// TODO: TAMO: can I get rids of the `non_exhaustive` on the IndexDocumentsMethod enum
|
||||||
|
_ => todo!(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let task = meilisearch.register_update(index_uid, update).await?.into();
|
let task = meilisearch.register_task(task).await?;
|
||||||
|
|
||||||
debug!("returns: {:?}", task);
|
debug!("returns: {:?}", task);
|
||||||
Ok(task)
|
Ok(task)
|
||||||
@ -293,11 +305,11 @@ pub async fn delete_documents(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let update = Update::DeleteDocuments(ids);
|
let task = KindWithContent::DocumentDeletion {
|
||||||
let task: SummarizedTaskView = meilisearch
|
index_uid: path.into_inner(),
|
||||||
.register_update(path.into_inner(), update)
|
documents_ids: ids,
|
||||||
.await?
|
};
|
||||||
.into();
|
let task = meilisearch.register_task(task).await?;
|
||||||
|
|
||||||
debug!("returns: {:?}", task);
|
debug!("returns: {:?}", task);
|
||||||
Ok(HttpResponse::Accepted().json(task))
|
Ok(HttpResponse::Accepted().json(task))
|
||||||
@ -307,11 +319,10 @@ pub async fn clear_all_documents(
|
|||||||
meilisearch: GuardedData<ActionPolicy<{ actions::DOCUMENTS_DELETE }>, MeiliSearch>,
|
meilisearch: GuardedData<ActionPolicy<{ actions::DOCUMENTS_DELETE }>, MeiliSearch>,
|
||||||
path: web::Path<String>,
|
path: web::Path<String>,
|
||||||
) -> Result<HttpResponse, ResponseError> {
|
) -> Result<HttpResponse, ResponseError> {
|
||||||
let update = Update::ClearDocuments;
|
let task = KindWithContent::DocumentClear {
|
||||||
let task: SummarizedTaskView = meilisearch
|
index_uid: path.into_inner(),
|
||||||
.register_update(path.into_inner(), update)
|
};
|
||||||
.await?
|
let task = meilisearch.register_task(task).await?;
|
||||||
.into();
|
|
||||||
|
|
||||||
debug!("returns: {:?}", task);
|
debug!("returns: {:?}", task);
|
||||||
Ok(HttpResponse::Accepted().json(task))
|
Ok(HttpResponse::Accepted().json(task))
|
||||||
|
Loading…
Reference in New Issue
Block a user