mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Rename browse_documents into get_all_documents and always respond HTTP Ok
This commit is contained in:
parent
530738cfe9
commit
1f1cb1f501
@ -74,7 +74,7 @@ struct BrowseQuery {
|
|||||||
attributes_to_retrieve: Option<String>,
|
attributes_to_retrieve: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn browse_documents(ctx: Context<Data>) -> SResult<Response> {
|
pub async fn get_all_documents(ctx: Context<Data>) -> SResult<Response> {
|
||||||
ctx.is_allowed(DocumentsRead)?;
|
ctx.is_allowed(DocumentsRead)?;
|
||||||
|
|
||||||
let index = ctx.index()?;
|
let index = ctx.index()?;
|
||||||
@ -114,15 +114,9 @@ pub async fn browse_documents(ctx: Context<Data>) -> SResult<Response> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if response_body.is_empty() {
|
Ok(tide::response::json(response_body)
|
||||||
Ok(tide::response::json(response_body)
|
.with_status(StatusCode::OK)
|
||||||
.with_status(StatusCode::NO_CONTENT)
|
.into_response())
|
||||||
.into_response())
|
|
||||||
} else {
|
|
||||||
Ok(tide::response::json(response_body)
|
|
||||||
.with_status(StatusCode::OK)
|
|
||||||
.into_response())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn infered_schema(document: &IndexMap<String, Value>) -> Option<meilidb_schema::Schema> {
|
fn infered_schema(document: &IndexMap<String, Value>) -> Option<meilidb_schema::Schema> {
|
||||||
|
@ -42,7 +42,7 @@ pub fn load_routes(app: &mut tide::App<Data>) {
|
|||||||
router.at("/documents").nest(|router| {
|
router.at("/documents").nest(|router| {
|
||||||
router
|
router
|
||||||
.at("/")
|
.at("/")
|
||||||
.get(document::browse_documents)
|
.get(document::get_all_documents)
|
||||||
.post(document::add_or_replace_multiple_documents)
|
.post(document::add_or_replace_multiple_documents)
|
||||||
.put(document::add_or_update_multiple_documents)
|
.put(document::add_or_update_multiple_documents)
|
||||||
.delete(document::clear_all_documents);
|
.delete(document::clear_all_documents);
|
||||||
|
Loading…
Reference in New Issue
Block a user